1、安装
npm install --save html2canvas
2、引用
import html2canvas from ‘html2canvas’
components: {
html2canvas
},
3、使用
//下载图片
handleSave() {
html2canvas(this.$refs.ylCodeSave).then(canvas => {
let imgData = canvas.toDataURL();
let data = {
imageUrl: imgData
};
SaveImageToAlbum(data);
})
},