Fixed initial value issue in form components

pull/6632/head
Mert Sincan 2024-10-22 11:26:56 +01:00
parent f8e55a2296
commit fbb0131b7e
1 changed files with 9 additions and 0 deletions

View File

@ -63,6 +63,12 @@ export default {
handler(newValue) {
this.formField = this.$pcForm?.register?.(newValue, this.formControl) || {};
}
},
$formDefaultValue: {
immediate: true,
handler(newValue) {
this.d_value !== newValue && (this.d_value = newValue);
}
}
},
formField: {},
@ -90,6 +96,9 @@ export default {
$formName() {
return this.formControl?.name || this.name;
},
$formDefaultValue() {
return this.d_value ?? this.$pcForm?.initialValues?.[this.$formName];
},
uncontolled() {
return this.defaultValue !== undefined && this.modelValue === undefined;
},