更新 Select 组件
select组件如果有filterable属性,对model进行修改,选择框为空值。
This commit is contained in:
parent
d33b339a10
commit
9c3a3e7d03
1 changed files with 17 additions and 13 deletions
|
@ -478,22 +478,25 @@
|
||||||
setQuery (query) {
|
setQuery (query) {
|
||||||
if (!this.filterable) return;
|
if (!this.filterable) return;
|
||||||
this.query = query;
|
this.query = query;
|
||||||
|
},
|
||||||
|
modelToQuery() {
|
||||||
|
if (!this.multiple && this.filterable && this.model) {
|
||||||
|
this.findChild((child) => {
|
||||||
|
if (this.model === child.value) {
|
||||||
|
if (child.label) {
|
||||||
|
this.query = child.label;
|
||||||
|
} else if (child.searchLabel) {
|
||||||
|
this.query = child.searchLabel;
|
||||||
|
} else {
|
||||||
|
this.query = child.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
compiled () {
|
compiled () {
|
||||||
if (!this.multiple && this.filterable && this.model) {
|
this.modelToQuery()
|
||||||
this.findChild((child) => {
|
|
||||||
if (this.model === child.value) {
|
|
||||||
if (child.label) {
|
|
||||||
this.query = child.label;
|
|
||||||
} else if (child.searchLabel) {
|
|
||||||
this.query = child.searchLabel;
|
|
||||||
} else {
|
|
||||||
this.query = child.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateOptions(true);
|
this.updateOptions(true);
|
||||||
document.addEventListener('keydown', this.handleKeydown);
|
document.addEventListener('keydown', this.handleKeydown);
|
||||||
|
@ -521,6 +524,7 @@
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
model () {
|
model () {
|
||||||
|
this.modelToQuery()
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
if (this.slotChangeDuration) {
|
if (this.slotChangeDuration) {
|
||||||
this.slotChangeDuration = false;
|
this.slotChangeDuration = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue