From aad48adcafcf5c2d948ac599437806df44e4b600 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Fri, 14 Jan 2022 10:40:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E9=94=80=E6=AF=81canvas=E7=94=BB=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangepage/edittemplate/main.js | 8 +++++--- src/pages/exchangepage/edittemplate/wangeditorCom.js | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index f6765ffd..6a214aa7 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -341,7 +341,6 @@ getLandingdata(val){ let path = null; let canvasEle=this.canvasImg;  //获取元素 let scrolDom=this.canvascrol; - console.log(351,this); scrolDom.scrollTop = 0; let dom=document.querySelector('.xj-viewer-mask'); let dom2=document.querySelector('.editor-main'); @@ -357,7 +356,6 @@ getLandingdata(val){ }).then(async (canvas) => { //处理你生成的canvas document.body.appendChild(canvas); - let a = document.createElement('a'); let file = canvas.toDataURL( ); let thumbimg= self.dataURLtoFile(file,'image/png'); let imgformdata= new FormData(); @@ -479,7 +477,11 @@ getLandingdata(val){ }; - + componentWillUnmount(){ + if(document.querySelector('canvas')){ + document.querySelector('canvas').remove(); + } + } render(){ diff --git a/src/pages/exchangepage/edittemplate/wangeditorCom.js b/src/pages/exchangepage/edittemplate/wangeditorCom.js index c5586151..bc8d381f 100644 --- a/src/pages/exchangepage/edittemplate/wangeditorCom.js +++ b/src/pages/exchangepage/edittemplate/wangeditorCom.js @@ -14,9 +14,10 @@ export default class wangeditor extends React.Component{ const editor = new Editor('#wangeditorDom') this.setState({editor}); editor.config.colors = [ - '#880000', - '#800080', - '#ff0000' + '#696969', + '#9093a2', + '#fgddbb', + '#e3e7eb' ]; editor.config.pasteText = true; // 设置编辑区域高度为 500px