This commit is contained in:
mo.duan 2019-11-22 10:50:33 +08:00
parent 5f04795b70
commit 87f01c5dab

View file

@ -660,10 +660,9 @@
} }
this.isFocused = true; // so we put back focus after clicking with mouse on option elements this.isFocused = true; // so we put back focus after clicking with mouse on option elements
} else { } else {
this.query = String(option.label).trim(); this.query = '';
this.values = [option]; this.values = [option];
this.lastRemoteQuery = ''; this.lastRemoteQuery = '';
this.query = '';
this.hideMenu(); this.hideMenu();
} }
if (this.filterable){ if (this.filterable){
@ -718,9 +717,10 @@
value(value){ value(value){
const {getInitialValue, getOptionData, publicValue, values} = this; const {getInitialValue, getOptionData, publicValue, values} = this;
this.checkUpdateStatus(); this.checkUpdateStatus();
const vModelValue = (publicValue && this.labelInValue) ?
(this.multiple ? publicValue.map(({value}) => value) : publicValue.value) : publicValue;
if (value === '') this.values = []; if (value === '') this.values = [];
else if (checkValuesNotEqual(value,publicValue,values)) { else if (checkValuesNotEqual(value,vModelValue,values)) {
this.$nextTick(() => this.values = getInitialValue().map(getOptionData).filter(Boolean)); this.$nextTick(() => this.values = getInitialValue().map(getOptionData).filter(Boolean));
if (!this.multiple) this.dispatch('FormItem', 'on-form-change', this.publicValue); if (!this.multiple) this.dispatch('FormItem', 'on-form-change', this.publicValue);
} }