File tree 3 files changed +7
-4
lines changed
docs/src/components/common-ui
packages/@core/ui-kit/form-ui/src
3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -327,7 +327,7 @@ useVbenForm 返回的第二个参数,是一个对象,包含了一些表单
327
327
328
328
::: tip handleValuesChange
329
329
330
- ` handleValuesChange ` 回调函数的第一个参数` values ` 装载了表单改变后的当前值对象,第二个参数` fieldsChanged ` 是一个数组,包含了所有被改变的字段名。注意:第二个参数仅在v5.5.4(不含)以上版本可用。
330
+ ` handleValuesChange ` 回调函数的第一个参数` values ` 装载了表单改变后的当前值对象,第二个参数` fieldsChanged ` 是一个数组,包含了所有被改变的字段名。注意:第二个参数仅在v5.5.4(不含)以上版本可用,并且传递的是已在schema中定义的字段名。如果你使用了字段映射并且需要检查是哪些字段发生了变化的话,请注意该参数并不会包含映射后的字段名 。
331
331
332
332
:::
333
333
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ async function handleReset(e: Event) {
62
62
e ?.stopPropagation ();
63
63
const props = unref (rootProps );
64
64
65
- const values = toRaw (props .formApi ?.getValues ());
65
+ const values = toRaw (await props .formApi ?.getValues ());
66
66
67
67
if (isFunction (props .handleReset )) {
68
68
await props .handleReset ?.(values );
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ onMounted(async () => {
72
72
await nextTick ();
73
73
watch (
74
74
() => form .values ,
75
- (newVal ) => {
75
+ async (newVal ) => {
76
76
if (forward .value .handleValuesChange ) {
77
77
const fields = state .value .schema ?.map ((item ) => {
78
78
return item .fieldName ;
@@ -91,7 +91,10 @@ onMounted(async () => {
91
91
92
92
if (changedFields .length > 0 ) {
93
93
// 调用handleValuesChange回调,传入所有表单值的深拷贝和变更的字段列表
94
- forward .value .handleValuesChange (cloneDeep (newVal ), changedFields );
94
+ forward .value .handleValuesChange (
95
+ cloneDeep (await forward .value .formApi .getValues ()),
96
+ changedFields ,
97
+ );
95
98
}
96
99
}
97
100
}
You can’t perform that action at this time.
0 commit comments