zoukankan      html  css  js  c++  java
  • 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 html2canvas@1.0.0-rc.4】

    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)
    });
    }

    参考链接:https://github.com/FEA-Dven/html2Canvas

  • 相关阅读:
    Python装饰器
    Python常用内建模块
    Python文件的操作
    Python集合的操作
    Python字典的操作
    Python列表元组的操作
    os.path
    Python字符串的操作
    线性回归
    随机森林
  • 原文地址:https://www.cnblogs.com/haqiao/p/13236858.html
Copyright © 2011-2022 走看看