Fixed controlled mode issue
parent
4929f978f2
commit
ed343909db
|
@ -74,15 +74,13 @@ export default {
|
||||||
formField: {},
|
formField: {},
|
||||||
methods: {
|
methods: {
|
||||||
updateValue(value, event) {
|
updateValue(value, event) {
|
||||||
// uncontrolled
|
if (this.controlled) {
|
||||||
if (this.uncontolled) {
|
|
||||||
this.$emit('value-change', value);
|
|
||||||
} else {
|
|
||||||
// controlled
|
|
||||||
this.d_value = value;
|
this.d_value = value;
|
||||||
this.$emit('update:modelValue', value);
|
this.$emit('update:modelValue', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$emit('value-change', value);
|
||||||
|
|
||||||
this.formField.onChange?.({ originalEvent: event, value });
|
this.formField.onChange?.({ originalEvent: event, value });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -99,8 +97,8 @@ export default {
|
||||||
$formDefaultValue() {
|
$formDefaultValue() {
|
||||||
return this.d_value ?? this.$pcForm?.initialValues?.[this.$formName];
|
return this.d_value ?? this.$pcForm?.initialValues?.[this.$formName];
|
||||||
},
|
},
|
||||||
uncontolled() {
|
controlled() {
|
||||||
return this.defaultValue !== undefined && this.modelValue === undefined;
|
return this.defaultValue === undefined;
|
||||||
},
|
},
|
||||||
// @deprecated use $filled instead
|
// @deprecated use $filled instead
|
||||||
filled() {
|
filled() {
|
||||||
|
|
Loading…
Reference in New Issue