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: {}, 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() {