修复渐变色bug
This commit is contained in:
@@ -917,7 +917,7 @@ export default defineComponent({
|
||||
this.colorList[this.selectIndex].gradient = JSON.parse(JSON.stringify(this.gradient))
|
||||
}else{
|
||||
this.selectColor = {rgba:this.colorList[this.selectIndex].gradient.gradientList[0].rgba}
|
||||
this.colorList[this.selectIndex].gradient = ''
|
||||
this.colorList[this.selectIndex].gradient = {}
|
||||
}
|
||||
let colorList =this.colorList.filter((v) => v && Object.keys(v).length)
|
||||
},
|
||||
|
||||
@@ -771,7 +771,7 @@ export default defineComponent({
|
||||
this.colorList[this.selectIndex].gradient = JSON.parse(JSON.stringify(this.gradient))
|
||||
}else{
|
||||
this.selectColor = {rgba:this.colorList[this.selectIndex].gradient.gradientList[0].rgba}
|
||||
this.colorList[this.selectIndex].gradient = ''
|
||||
this.colorList[this.selectIndex].gradient = {}
|
||||
}
|
||||
let colorList =this.colorList.filter((v) => v && Object.keys(v).length)
|
||||
this.setColorboardList(colorList)
|
||||
|
||||
@@ -83,6 +83,7 @@ export default defineComponent({
|
||||
let poss = ref([])
|
||||
let loading = ref(false)
|
||||
let computedHeight = 0
|
||||
let imgDom = ref()
|
||||
return{
|
||||
list,
|
||||
wait_list,
|
||||
@@ -93,6 +94,7 @@ export default defineComponent({
|
||||
poss,
|
||||
loading,
|
||||
computedHeight,
|
||||
imgDom,
|
||||
}
|
||||
},
|
||||
directives:{
|
||||
@@ -146,6 +148,7 @@ export default defineComponent({
|
||||
// 挂载方法
|
||||
methods: {
|
||||
clearData(){
|
||||
this.wait_list = []
|
||||
this.width = 300
|
||||
this.num_x = 1
|
||||
this.gap_x = 0
|
||||
@@ -154,6 +157,10 @@ export default defineComponent({
|
||||
this.loading = false
|
||||
this.list = []
|
||||
this.resize()
|
||||
if(this.imgDom){
|
||||
this.imgDom.remove();
|
||||
this.imgDom = null
|
||||
}
|
||||
},
|
||||
push(arr) {
|
||||
this.wait_list = this.wait_list.concat(arr);
|
||||
@@ -180,14 +187,15 @@ export default defineComponent({
|
||||
|
||||
let url = this.wait_list[0].canvasUrl;
|
||||
let data = this.wait_list[0]
|
||||
let img = document.createElement("img");
|
||||
img.src = url;
|
||||
img.style.width = this.width + "px";
|
||||
img.style.maxHeight = this.width+330 + "px";
|
||||
img.style.position = "absolute";
|
||||
img.style.top = "-99999px";
|
||||
document.body.appendChild(img);
|
||||
img.addEventListener("load", () => {
|
||||
this.imgDom = document.createElement("img");
|
||||
this.imgDom.src = url;
|
||||
this.imgDom.style.width = this.width + "px";
|
||||
this.imgDom.style.maxHeight = this.width+330 + "px";
|
||||
this.imgDom.style.position = "absolute";
|
||||
this.imgDom.style.top = "-99999px";
|
||||
document.body.appendChild(this.imgDom);
|
||||
this.imgDom.addEventListener("load", () => {
|
||||
if(!this.imgDom) return
|
||||
var idx = 0;
|
||||
var pos_num = this.poss[idx];
|
||||
for (var i = 1; i < this.poss.length; i++) {
|
||||
@@ -196,8 +204,8 @@ export default defineComponent({
|
||||
pos_num = this.poss[i];
|
||||
}
|
||||
}
|
||||
let width = img.offsetWidth;
|
||||
let height = img.offsetHeight+this.computedHeight;
|
||||
let width = this.imgDom.offsetWidth;
|
||||
let height = this.imgDom.offsetHeight+this.computedHeight;
|
||||
let top = this.poss[idx] + this.gap_y;
|
||||
let left = (idx + 1) * this.gap_x + idx * width;
|
||||
let imgHeight = height - this.computedHeight
|
||||
@@ -208,7 +216,8 @@ export default defineComponent({
|
||||
...data
|
||||
};
|
||||
this.list.push(obj);
|
||||
img.remove();
|
||||
this.imgDom.remove();
|
||||
this.imgDom = null
|
||||
this.wait_list.splice(0, 1);
|
||||
this.$el.style.height =
|
||||
Math.max(...this.poss) + this.gap_y + "px";
|
||||
|
||||
Reference in New Issue
Block a user