修复渐变色bug

This commit is contained in:
X1627315083
2024-07-15 12:00:40 +08:00
parent 55d19a3969
commit 88f1b568c7
4 changed files with 24 additions and 15 deletions

View File

@@ -917,7 +917,7 @@ export default defineComponent({
this.colorList[this.selectIndex].gradient = JSON.parse(JSON.stringify(this.gradient)) this.colorList[this.selectIndex].gradient = JSON.parse(JSON.stringify(this.gradient))
}else{ }else{
this.selectColor = {rgba:this.colorList[this.selectIndex].gradient.gradientList[0].rgba} 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) let colorList =this.colorList.filter((v) => v && Object.keys(v).length)
}, },

View File

@@ -771,7 +771,7 @@ export default defineComponent({
this.colorList[this.selectIndex].gradient = JSON.parse(JSON.stringify(this.gradient)) this.colorList[this.selectIndex].gradient = JSON.parse(JSON.stringify(this.gradient))
}else{ }else{
this.selectColor = {rgba:this.colorList[this.selectIndex].gradient.gradientList[0].rgba} 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) let colorList =this.colorList.filter((v) => v && Object.keys(v).length)
this.setColorboardList(colorList) this.setColorboardList(colorList)

View File

@@ -83,6 +83,7 @@ export default defineComponent({
let poss = ref([]) let poss = ref([])
let loading = ref(false) let loading = ref(false)
let computedHeight = 0 let computedHeight = 0
let imgDom = ref()
return{ return{
list, list,
wait_list, wait_list,
@@ -93,6 +94,7 @@ export default defineComponent({
poss, poss,
loading, loading,
computedHeight, computedHeight,
imgDom,
} }
}, },
directives:{ directives:{
@@ -146,6 +148,7 @@ export default defineComponent({
// 挂载方法 // 挂载方法
methods: { methods: {
clearData(){ clearData(){
this.wait_list = []
this.width = 300 this.width = 300
this.num_x = 1 this.num_x = 1
this.gap_x = 0 this.gap_x = 0
@@ -154,6 +157,10 @@ export default defineComponent({
this.loading = false this.loading = false
this.list = [] this.list = []
this.resize() this.resize()
if(this.imgDom){
this.imgDom.remove();
this.imgDom = null
}
}, },
push(arr) { push(arr) {
this.wait_list = this.wait_list.concat(arr); this.wait_list = this.wait_list.concat(arr);
@@ -180,14 +187,15 @@ export default defineComponent({
let url = this.wait_list[0].canvasUrl; let url = this.wait_list[0].canvasUrl;
let data = this.wait_list[0] let data = this.wait_list[0]
let img = document.createElement("img"); this.imgDom = document.createElement("img");
img.src = url; this.imgDom.src = url;
img.style.width = this.width + "px"; this.imgDom.style.width = this.width + "px";
img.style.maxHeight = this.width+330 + "px"; this.imgDom.style.maxHeight = this.width+330 + "px";
img.style.position = "absolute"; this.imgDom.style.position = "absolute";
img.style.top = "-99999px"; this.imgDom.style.top = "-99999px";
document.body.appendChild(img); document.body.appendChild(this.imgDom);
img.addEventListener("load", () => { this.imgDom.addEventListener("load", () => {
if(!this.imgDom) return
var idx = 0; var idx = 0;
var pos_num = this.poss[idx]; var pos_num = this.poss[idx];
for (var i = 1; i < this.poss.length; i++) { for (var i = 1; i < this.poss.length; i++) {
@@ -196,8 +204,8 @@ export default defineComponent({
pos_num = this.poss[i]; pos_num = this.poss[i];
} }
} }
let width = img.offsetWidth; let width = this.imgDom.offsetWidth;
let height = img.offsetHeight+this.computedHeight; let height = this.imgDom.offsetHeight+this.computedHeight;
let top = this.poss[idx] + this.gap_y; let top = this.poss[idx] + this.gap_y;
let left = (idx + 1) * this.gap_x + idx * width; let left = (idx + 1) * this.gap_x + idx * width;
let imgHeight = height - this.computedHeight let imgHeight = height - this.computedHeight
@@ -208,7 +216,8 @@ export default defineComponent({
...data ...data
}; };
this.list.push(obj); this.list.push(obj);
img.remove(); this.imgDom.remove();
this.imgDom = null
this.wait_list.splice(0, 1); this.wait_list.splice(0, 1);
this.$el.style.height = this.$el.style.height =
Math.max(...this.poss) + this.gap_y + "px"; Math.max(...this.poss) + this.gap_y + "px";

View File

@@ -156,8 +156,8 @@ export default defineComponent({
filter.isNull = false filter.isNull = false
} }
if (rv.content.length > 0) { if (rv.content.length > 0) {
filter.isNull = false filter.isNull = false
fall.value.push(rv.content); fall.value.push(rv.content);
} else { } else {
filter.isNoData = true filter.isNoData = true
} }