您现在的位置是:首页 > 前端会客厅 > web前端web前端
vue中使用html2canvas.js
YU到边2021-01-09【web前端】人已围观
简介使用html2canvas.js在vue中把Dom转换为图片
<template>
<div>
<div class="DataAnlysis" @click="clickanlysis()"></div>
<div id="map" ref="map"></div>
</div>
</template>
import html2 from 'html2canvas';
methods:{
clickanlysis(divText, imgText){
html2(this.$refs.map).then(canvas => {
let link = document.createElement("a");
link.href = canvas.toDataURL();//下载链接
link.setAttribute("download","map.png");
link.style.display = "none";//a标签隐藏
document.body.appendChild(link);
link.click();
});
}
}
Tags:vue html2canvas.js
很赞哦! ()
上一篇:返回列表
下一篇:js关于复制粘贴的一些相关操作