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; } }); }
posted @ 2020-01-03 09:05  番茄西红柿u  阅读(1670)  评论(0编辑  收藏  举报