美文网首页
关于html2canvas 绘制图片跨域、ios不显示问题

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

作者: 始与初见好吗 | 来源:发表于2020-08-27 15:10 被阅读0次

一、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不显示问题

      本文链接:https://www.haomeiwen.com/subject/uxicsktx.html