edit: simplification highlight sans array intermédiaire
This commit is contained in:
+4
-16
@@ -295,22 +295,10 @@ import { toRaw } from 'vue'
|
|||||||
console.log(this.marjTop,this.marjBot,this.marjSide);
|
console.log(this.marjTop,this.marjBot,this.marjSide);
|
||||||
},
|
},
|
||||||
selectHighlight(){
|
selectHighlight(){
|
||||||
let index = [];
|
this.isHighlight.forEach(([id, level]) => {
|
||||||
let hClass = [];
|
const item = this.items.find(item => item.id === id);
|
||||||
for(let k=0; k<this.isHighlight.length; k++){
|
if (item) item.isHighlight = level;
|
||||||
index.splice(k,0,this.isHighlight[k][0]);
|
});
|
||||||
hClass.splice(k,0,this.isHighlight[k][1]);
|
|
||||||
};
|
|
||||||
console.log(index,hClass);
|
|
||||||
for (let i=0; i<this.items.length; i++){
|
|
||||||
let selectedItem = this.items[i].id;
|
|
||||||
if (index.includes(selectedItem)){
|
|
||||||
let selectIndex = index.indexOf(selectedItem);
|
|
||||||
this.items[i].isHighlight = hClass[selectIndex];
|
|
||||||
}else{
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log(this.items)
|
console.log(this.items)
|
||||||
},
|
},
|
||||||
selectRandomGraffs(){
|
selectRandomGraffs(){
|
||||||
|
|||||||
Reference in New Issue
Block a user