记录html2canvas页面截图
由于项目需要页面截图功能,所以找到了html2canvas插件
//jsasyncgoShare(){letdom=this.$refs["shareDom"];constres=awaithtml2canvas(dom,{width:parseInt(window.getComputedStyle(dom).width),height:parseInt(window.getComputedStyle(dom).height),allowTaint:true,taintTest:false,scale:window.devicePixelRatio,//设备像素比ignoreElements:(element)=>{//可从渲染中删除匹配的元素if(element.className==='exclude')returntrue;},})this.imgUrl=res.toDataURL()}最后是一张base64图片。