美文网首页
html2canvas 使用

html2canvas 使用

作者: 抽疯的稻草绳 | 来源:发表于2022-11-12 20:45 被阅读0次

 npm install --save html2canvas


import html2canvas from 'html2canvas'

 components: {
    html2canvas
  },

 html2canvas(this.$refs.screenRefs, {
        allowTaint: true, ///允许跨域图片
        useCORS: true, //是否尝试使用CORS从服务器加载图像
      }).then((canvas) => {
        let aseurl = canvas.toDataURL("image/jpeg", 0.7) //得到图片的base64编码数据
       
      })

相关文章

网友评论

      本文标题:html2canvas 使用

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