Closed tonytu0510 closed 5 years ago
saveImg(){ let lowerCas=this.$refs.tuiImageEditor.getRootElement().getElementsByClassName("lower-canvas")[0] let upperCas=this.$refs.tuiImageEditor.getRootElement().getElementsByClassName("upper-canvas ")[0] const canvasSize = this.$refs.tuiImageEditor.invoke('getCanvasSize') let width=canvasSize.width let height=canvasSize.height lowerCas.getContext("2d").drawImage(upperCas,0,0,width,height); // 把画布的内容转换为base64编码格式的图片 let data = lowerCas.toDataURL( 'image/png', 1 ); //1表示质量(无损压缩) console.log(data) }
For further reference, I achieved it this way:
Add a reference to your vue element:
<tui-image-editor ref="tuiEditor" />
On your save method:
save() {
const image = this.$refs.tuiEditor.editorInstance.toDataURL();
console.log(image);
}
Link to the documentation
en en thanks
在 2019-03-27 01:07:06,"Rodrigo Mata" notifications@github.com 写道:
For further reference, I achieved it this way:
Add a reference to your vue element:
On your save method:
save() { constimage=this.$refs.tuiEditor.editorInstance.toDataURL(); console.log(image); }
Link to the documentation
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
hello world~~~ 我想保存编辑后的图片到数据库 请问有什么办法可以做到吗 谢谢