在图层上有图像和线条的v-组,像这样的舞台:
<button @click="export"></button>
<v-layer ref="layer">
<v-group>
<v-image :config="configBackground"></v-image>
<v-line
v-for="line in lines"
:key="line.id"
:config="{
stroke: 'red',
points: line.points,
}"
/>
</v-group>
</v-layer>在我的函数中,我尝试从stage获取dataurl以保存img:
export(e) {
//console.log(e.target.getStage())
let dataURL = e.target.toDataURL()
console.log(dataURL)
// this.download(dataURL, "img.png")
},如果单击按钮,就会得到e.target.toDataURL不是函数。
如何让dataURL保存图像?
发布于 2022-02-03 16:08:51
这对我来说很有用
let stage = vm.$refs.stage.getNode()
let dataURL = stage.toDataURL()https://stackoverflow.com/questions/70972630
复制相似问题