html2canvas绘图

htmlToCanvas(area){
        let that=this
        this.isPrint=true
        let name='面试维度.png'
        return new Promise((res,rej)=>{
          setTimeout(()=>{
            html2canvas(area,{
                width:area.clientWidth,
                height:area.clientHeight,
                scale: 1,
                useCORS:true,
            }).then(canvas => { 
              res(canvas)
            })
          },300)
        }) 
      },
      download() {
        let that=this
        this.isPrint=true
        let name='面试维度.png'
        setTimeout(()=>{
          this.htmlToCanvas(this.$refs.downAreaWrap2).then(canvas=>{
            if(that.isIEOrEdge()){
                let blob = canvas.msToBlob();
                navigator.msSaveBlob(blob,name);
                that.isPrint=false
            } else {
              let link=document.createElement('a')
              link.href=canvas.toDataURL()
              link.download = name
              link.style.display='none'
              document.body.appendChild(link)
              link.click()
              document.body.removeChild(link)
              that.isPrint=false
            }       
          })
        },300)   
      },

你可能感兴趣的:(html2canvas绘图)