mirror of https://github.com/ElemeFE/element
fix: element cascader 手动操作options全量更新nodes 搜索suggestions失去响应式问题 :手动记录上一次搜索 重新绑定新nodes
parent
c345bb453b
commit
b6ffb321bc
|
@ -235,6 +235,7 @@ export default {
|
||||||
checkedValue: this.value,
|
checkedValue: this.value,
|
||||||
inputHover: false,
|
inputHover: false,
|
||||||
inputValue: null,
|
inputValue: null,
|
||||||
|
lastInputValue: null, // Last effective inputValue
|
||||||
presentText: null,
|
presentText: null,
|
||||||
presentTags: [],
|
presentTags: [],
|
||||||
checkedNodes: [],
|
checkedNodes: [],
|
||||||
|
@ -328,7 +329,18 @@ export default {
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
handler: function() {
|
handler: function() {
|
||||||
this.$nextTick(this.computePresentContent);
|
this.$nextTick(() => {
|
||||||
|
this.computePresentContent()
|
||||||
|
|
||||||
|
if(this.filtering) {
|
||||||
|
this.suggestions = this.panel.getFlattedNodes(this.leafOnly)
|
||||||
|
.filter(node => {
|
||||||
|
if (node.isDisabled) return false;
|
||||||
|
node.text = node.getText(this.showAllLevels, this.separator) || '';
|
||||||
|
return filterMethod(node, this.lastInputValue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
},
|
},
|
||||||
|
@ -342,6 +354,11 @@ export default {
|
||||||
},
|
},
|
||||||
filtering(val) {
|
filtering(val) {
|
||||||
this.$nextTick(this.updatePopper);
|
this.$nextTick(this.updatePopper);
|
||||||
|
},
|
||||||
|
inputValue(newVal, oldVal) {
|
||||||
|
const oldValue = oldVal && oldVal !== ' ' ? oldVal : this.lastInputValue
|
||||||
|
const newValue = newVal && newVal !== ' ' ? newVal : false
|
||||||
|
this.lastInputValue = newValue || oldValue || ' '
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue