vue div转图片
1. npm install --save html2canvas
2. import html2canvas from "html2canvas"
3.
toImage() { html2canvas(this.$refs.imageWrapper).then(canvas => { //imageWrapper转换图片的dom
let dataURL = canvas.toDataURL("image/png"); this.imgUrl = dataURL; if (this.imgUrl !== "") { this.dialogTableVisible = true; } }); }