2
0
mirror of https://github.com/tenrok/vue-context.git synced 2026-05-17 11:39:36 +03:00

Make localItemSelector reactive to changes from itemSelector prop

This commit is contained in:
Randall Wilk
2019-07-28 10:52:03 -05:00
parent 941e8f6939
commit bf58a429fd
2 changed files with 19 additions and 7 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+18 -6
View File
@@ -49,16 +49,12 @@ export default {
left: null,
show: false,
data: null,
localItemSelector: this.itemSelector
localItemSelector: ''
};
},
created() {
if (isArray(this.localItemSelector)) {
this.localItemSelector = this.localItemSelector
.map(selector => `${selector}:not(.disabled):not([disabled])`)
.join(', ');
}
this.localItemSelector = this.mapItemSelector(this.itemSelector);
},
beforeDestroy() {
@@ -126,6 +122,16 @@ export default {
return filterVisible(selectAll(this.localItemSelector, this.$el));
},
mapItemSelector(itemSelector) {
if (isArray(itemSelector)) {
itemSelector = itemSelector
.map(selector => `${selector}:not(.disabled):not([disabled])`)
.join(', ');
}
return itemSelector;
},
onClick() {
this.close();
},
@@ -211,6 +217,12 @@ export default {
this.removeScrollEventListener();
}
},
itemSelector(selector, oldValue) {
if (selector !== oldValue) {
this.localItemSelector = this.mapItemSelector(selector);
}
}
},
render(h) {