From 45ca47457158e493dc52ea77c6de61be212d3496 Mon Sep 17 00:00:00 2001 From: cshaptx4869 <994774638@qq.com> Date: Thu, 23 May 2024 20:47:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(PageModal):=20:sparkles:=20watch=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E9=A1=B9=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PageModal/Form.vue | 2 +- src/components/PageModal/types.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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; }>;