Fixed controlled mode issue

pull/6632/head
Mert Sincan 2024-10-23 05:06:32 +01:00
parent 4929f978f2
commit ed343909db
1 changed files with 5 additions and 7 deletions

View File

@ -74,15 +74,13 @@ export default {
formField: {},
methods: {
updateValue(value, event) {
// uncontrolled
if (this.uncontolled) {
this.$emit('value-change', value);
} else {
// controlled
if (this.controlled) {
this.d_value = value;
this.$emit('update:modelValue', value);
}
this.$emit('value-change', value);
this.formField.onChange?.({ originalEvent: event, value });
}
},
@ -99,8 +97,8 @@ export default {
$formDefaultValue() {
return this.d_value ?? this.$pcForm?.initialValues?.[this.$formName];
},
uncontolled() {
return this.defaultValue !== undefined && this.modelValue === undefined;
controlled() {
return this.defaultValue === undefined;
},
// @deprecated use $filled instead
filled() {