Update select.vue

This commit is contained in:
梁灏 2021-09-16 16:24:37 +08:00
parent 3d6a354e97
commit ebf885fbdd

View file

@ -826,7 +826,7 @@
// (this.multiple ? this.publicValue.map(({value}) => value) : this.publicValue.value) :
// this.publicValue;
// labelInValue emit
const vModelValue = this.publicValue;
let vModelValue = this.publicValue;
const shouldEmitInput = newValue !== oldValue && vModelValue !== this.value;
if (shouldEmitInput) {
let emitValue = this.publicValue;
@ -837,6 +837,11 @@
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('on-change', emitValue);
this.dispatch('FormItem', 'on-form-change', emitValue);