Skip to content
This repository was archived by the owner on Oct 5, 2022. It is now read-only.

Commit bf58a42

Browse files
committed
Make localItemSelector reactive to changes from itemSelector prop
1 parent 941e8f6 commit bf58a42

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

dist/js/vue-context.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/vue-context.js

+18-6
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,12 @@ export default {
4949
left: null,
5050
show: false,
5151
data: null,
52-
localItemSelector: this.itemSelector
52+
localItemSelector: ''
5353
};
5454
},
5555

5656
created() {
57-
if (isArray(this.localItemSelector)) {
58-
this.localItemSelector = this.localItemSelector
59-
.map(selector => `${selector}:not(.disabled):not([disabled])`)
60-
.join(', ');
61-
}
57+
this.localItemSelector = this.mapItemSelector(this.itemSelector);
6258
},
6359

6460
beforeDestroy() {
@@ -126,6 +122,16 @@ export default {
126122
return filterVisible(selectAll(this.localItemSelector, this.$el));
127123
},
128124

125+
mapItemSelector(itemSelector) {
126+
if (isArray(itemSelector)) {
127+
itemSelector = itemSelector
128+
.map(selector => `${selector}:not(.disabled):not([disabled])`)
129+
.join(', ');
130+
}
131+
132+
return itemSelector;
133+
},
134+
129135
onClick() {
130136
this.close();
131137
},
@@ -211,6 +217,12 @@ export default {
211217
this.removeScrollEventListener();
212218
}
213219
},
220+
221+
itemSelector(selector, oldValue) {
222+
if (selector !== oldValue) {
223+
this.localItemSelector = this.mapItemSelector(selector);
224+
}
225+
}
214226
},
215227

216228
render(h) {

0 commit comments

Comments
 (0)