html2canvas 在IOS系统13.4以上失效的问题解决方法
一、问题描述
最近在开发 html2canvas 的时候,突然发现,html2canvas在IOS13.4.1系统中调用失败。后马上去github上查看是否有同道中人遇到类似问题。
参考链接:https://github.com/niklasvh/html2canvas/issues/2229
二、解决方案
1.首先将 package.json 中的 html2canvas 版本降低为【1.0.0-rc.4】
版本降低方法
首先移除 html2canvas 【npm uninstall html2canvas】
然后安装指定版本 【npm install --save 】
dependencies": {
"html2canvas": "^1.0.0-rc.4",
"less": "^3.11.1",
"less-loader": "^4.1.0",
"vue": "^2.5.2",
"vue-router": "^3.0.1"
},2.如果上述无法解决你的问题 再进行第2步
先点下方的参考链接下载修复过的html2canvas.js文件,在按下面的方法改代码
// 修改后代码 主要将 html2canvas 修改为 (window.html2canvas || html2canvas)
(window.html2canvas || html2canvas)(this.$refs.htmlCanvas, {
backgroundColor: null
}).then((canvas) => {
let dataURL = canvas.toDataURL("image/png");
this.shareImgUrl = dataURL;
console.log(this.dataURL)
});
} 相关推荐
MIKUScallion 2020-06-11
songfens 2020-03-20
northwindx 2020-01-04
jinxiutong 2019-12-27
大地飞鸿 2019-12-24
songfens 2019-12-06
飞翔的鱼 2019-11-17
大地飞鸿 2019-11-08
fanbih 2018-09-11
songfens 2019-10-21
yixiaof 2019-09-05
blair 2019-06-10
lanseguhui 2019-07-01
church 2019-07-01
lanseguhui 2019-07-01
Yaro 2019-07-01
yaosir 2019-07-01
yixiaof 2019-06-30