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:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+18
-6
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user