Skip to content

Commit db47517

Browse files
committed
before checkout
1 parent 247feb3 commit db47517

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

src/components/home_sidebar_items/Icons.vue

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -203,30 +203,33 @@ export default {
203203
}
204204
},
205205
// if activeComponent is updated, elementStorage will update its cache of elements & frequency to reflect new active component
206-
activeComponent: function () {
206+
activeComponent: {
207+
// deep: true,
208+
handler () {
207209
// console.log('watching activeComponent', this.activeComponent);
208-
console.log('watch: activeComponent');
209-
if (this.activeComponent) {
210-
this.elementStorage = {}
211-
this.componentMap[this.activeComponent].htmlList.forEach(el => {
212-
if (!this.elementStorage[el.text]) {
213-
this.elementStorage[el.text] = 1
214-
} else {
215-
this.elementStorage[el.text] += 1
216-
}
217-
})
218-
// console.log('elementStorage is ', this.elementStorage);
219-
} else if (this.activeComponent === '') {
220-
// console.log(`watching activeComponent, current active is ''`)
221-
// if component was switched from existing component to '', reset cache and update items
222-
if (this.elementStorage !== {}) this.elementStorage = {}
223-
this.selectedElementList.forEach(el => {
224-
if (!this.elementStorage[el.text]) {
225-
this.elementStorage[el.text] = 1
226-
} else {
227-
this.elementStorage[el.text] += 1
228-
}
229-
})
210+
console.log('watch: activeComponent');
211+
if (this.activeComponent) {
212+
this.elementStorage = {}
213+
this.componentMap[this.activeComponent].htmlList.forEach(el => {
214+
if (!this.elementStorage[el.text]) {
215+
this.elementStorage[el.text] = 1
216+
} else {
217+
this.elementStorage[el.text] += 1
218+
}
219+
})
220+
// console.log('elementStorage is ', this.elementStorage);
221+
} else if (this.activeComponent === '') {
222+
// console.log(`watching activeComponent, current active is ''`)
223+
// if component was switched from existing component to '', reset cache and update items
224+
if (this.elementStorage !== {}) this.elementStorage = {}
225+
this.selectedElementList.forEach(el => {
226+
if (!this.elementStorage[el.text]) {
227+
this.elementStorage[el.text] = 1
228+
} else {
229+
this.elementStorage[el.text] += 1
230+
}
231+
})
232+
}
230233
}
231234
}
232235
}

0 commit comments

Comments
 (0)