diff --git a/src/components/PageModal/Form.vue b/src/components/PageModal/Form.vue index 0a030b7b..a36d0655 100644 --- a/src/components/PageModal/Form.vue +++ b/src/components/PageModal/Form.vue @@ -118,7 +118,7 @@ for (const item of formItems) { watch( () => formData[item.prop], (newValue, oldValue) => { - item.watch && item.watch(newValue, oldValue, formData); + item.watch && item.watch(newValue, oldValue, formData, formItems); } ); }); diff --git a/src/components/PageModal/types.ts b/src/components/PageModal/types.ts index cddca5fb..4846b0af 100644 --- a/src/components/PageModal/types.ts +++ b/src/components/PageModal/types.ts @@ -54,11 +54,11 @@ export type IFormItems = Array<{ // 是否隐藏 hidden?: boolean; // 监听函数 - watch?: (newValue: any, oldValue: any, data: T) => void; + watch?: (newValue: any, oldValue: any, data: T, items: IObject[]) => void; // 计算属性函数 computed?: (data: T) => any; // 监听收集函数 watchEffect?: (data: T) => void; // 初始化数据函数扩展 - initFn?: (formItem: IObject) => void; + initFn?: (item: IObject) => void; }>;