@@ -203,30 +203,33 @@ export default {
203
203
}
204
204
},
205
205
// 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 () {
207
209
// 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
+ }
230
233
}
231
234
}
232
235
}
0 commit comments