This commit is contained in:
shijing 2022-05-07 15:22:52 +08:00
parent 7615236343
commit fe865bed58
1 changed files with 1 additions and 2 deletions

View File

@ -133,7 +133,7 @@
<el-row v-show="hasPicture"> <el-row v-show="hasPicture">
<el-form-item label="图表"> <el-form-item label="图表">
<div> <div>
<img id="canvasImg" :src="img" style="width:500px;height: 300px;display: none"> <img id="canvasImg" :src="img" style="width:500px;height: 300px;position: absolute;top: -1000px;">
<div style="position: relative;display: flex;flex-direction: column; <div style="position: relative;display: flex;flex-direction: column;
border: 1px solid #DCDFE6;"> border: 1px solid #DCDFE6;">
<canvas id="canvas" width="500" height="300"> <canvas id="canvas" width="500" height="300">
@ -435,7 +435,6 @@
//画布添加背景模板图 //画布添加背景模板图
draw(){ draw(){
let canvasImg = document.getElementById("canvasImg"); let canvasImg = document.getElementById("canvasImg");
canvasImg.src = encodeURI(this.img);
canvasImg.setAttribute("crossOrigin",'anonymous'); canvasImg.setAttribute("crossOrigin",'anonymous');
canvasImg.style.width = '500px'; canvasImg.style.width = '500px';
canvasImg.style.height = '300px'; canvasImg.style.height = '300px';