mirror of
https://github.com/tenrok/vue-context.git
synced 2026-06-12 23:22:22 +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,
|
left: null,
|
||||||
show: false,
|
show: false,
|
||||||
data: null,
|
data: null,
|
||||||
localItemSelector: this.itemSelector
|
localItemSelector: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
if (isArray(this.localItemSelector)) {
|
this.localItemSelector = this.mapItemSelector(this.itemSelector);
|
||||||
this.localItemSelector = this.localItemSelector
|
|
||||||
.map(selector => `${selector}:not(.disabled):not([disabled])`)
|
|
||||||
.join(', ');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
@@ -126,6 +122,16 @@ export default {
|
|||||||
return filterVisible(selectAll(this.localItemSelector, this.$el));
|
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() {
|
onClick() {
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
@@ -211,6 +217,12 @@ export default {
|
|||||||
this.removeScrollEventListener();
|
this.removeScrollEventListener();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
itemSelector(selector, oldValue) {
|
||||||
|
if (selector !== oldValue) {
|
||||||
|
this.localItemSelector = this.mapItemSelector(selector);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
render(h) {
|
render(h) {
|
||||||
|
|||||||
Reference in New Issue
Block a user