Update select.vue
This commit is contained in:
parent
3d6a354e97
commit
ebf885fbdd
1 changed files with 6 additions and 1 deletions
|
@ -826,7 +826,7 @@
|
||||||
// (this.multiple ? this.publicValue.map(({value}) => value) : this.publicValue.value) :
|
// (this.multiple ? this.publicValue.map(({value}) => value) : this.publicValue.value) :
|
||||||
// this.publicValue;
|
// this.publicValue;
|
||||||
// 改变 labelInValue 的实现:直接在 emit 时改数据
|
// 改变 labelInValue 的实现:直接在 emit 时改数据
|
||||||
const vModelValue = this.publicValue;
|
let vModelValue = this.publicValue;
|
||||||
const shouldEmitInput = newValue !== oldValue && vModelValue !== this.value;
|
const shouldEmitInput = newValue !== oldValue && vModelValue !== this.value;
|
||||||
if (shouldEmitInput) {
|
if (shouldEmitInput) {
|
||||||
let emitValue = this.publicValue;
|
let emitValue = this.publicValue;
|
||||||
|
@ -837,6 +837,11 @@
|
||||||
emitValue = this.values[0];
|
emitValue = this.values[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Form 重置时,如果初始值是 null,也置为 null,而不是 []
|
||||||
|
if (Array.isArray(vModelValue) && !vModelValue.length && this.value === null) vModelValue = null;
|
||||||
|
else if (vModelValue === undefined && this.value === null) vModelValue = null
|
||||||
|
|
||||||
this.$emit('input', vModelValue); // to update v-model
|
this.$emit('input', vModelValue); // to update v-model
|
||||||
this.$emit('on-change', emitValue);
|
this.$emit('on-change', emitValue);
|
||||||
this.dispatch('FormItem', 'on-form-change', emitValue);
|
this.dispatch('FormItem', 'on-form-change', emitValue);
|
||||||
|
|
Loading…
Add table
Reference in a new issue