关于html2canvas 绘制图片跨域、ios不显示问题

一、html2canvas在IOS微信中点击无反应

        使用 html2canvas 1.0.0-rc.4 这个指定版本即可

二、html2canvas图片跨域问题

    第一步:设置useCORS为true允许跨域

    new html2canvas(document.getElementById('printDiv'), {

              useCORS: true  //允许跨域

      }).then(canvas => {

              this.canvasImg = canvas.toDataURL("image/jpeg", 1); // 导出图片

              this.showPopup= true

    });

第二步:如果还不行,找到html2canvas.js(依赖包中dist下的html2canvas.js)下载到本地,然后更改img的src增加一个随机参数,然后使用本地静态js文件即可。


随机时间戳

你可能感兴趣的:(关于html2canvas 绘制图片跨域、ios不显示问题)