From e5098decfda23e0e4ee485202cab76c390d107eb Mon Sep 17 00:00:00 2001 From: cshaptx4869 <994774638@qq.com> Date: Tue, 14 May 2024 15:03:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(PageModal):=20:sparkles:=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81drawer=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PageModal/Form.vue | 147 +++++++++++++ src/components/PageModal/index.vue | 319 +++++++++-------------------- src/components/PageModal/types.ts | 57 ++++++ 3 files changed, 301 insertions(+), 222 deletions(-) create mode 100644 src/components/PageModal/Form.vue create mode 100644 src/components/PageModal/types.ts diff --git a/src/components/PageModal/Form.vue b/src/components/PageModal/Form.vue new file mode 100644 index 00000000..bf29a6dc --- /dev/null +++ b/src/components/PageModal/Form.vue @@ -0,0 +1,147 @@ + + + diff --git a/src/components/PageModal/index.vue b/src/components/PageModal/index.vue index 6f49e969..f371bd50 100644 --- a/src/components/PageModal/index.vue +++ b/src/components/PageModal/index.vue @@ -1,193 +1,87 @@ diff --git a/src/components/PageModal/types.ts b/src/components/PageModal/types.ts new file mode 100644 index 00000000..dfd8a317 --- /dev/null +++ b/src/components/PageModal/types.ts @@ -0,0 +1,57 @@ +import type { + DialogProps, + DrawerProps, + FormProps, + FormItemRule, +} from "element-plus"; + +// dialog组件属性 +export type IDialog = Partial>; + +// drawer组件属性 +export type IDrawer = Partial>; + +// form组件属性 +export type IForm = Partial>; + +// 对象类型 +export type IObject = Record; + +// 表单项 +export type IFormItems = Array<{ + // 组件类型(如input,select,radio,custom等,默认input) + type?: + | "input" + | "select" + | "radio" + | "checkbox" + | "tree-select" + | "date-picker" + | "input-number" + | "custom"; + // 组件属性 + attrs?: IObject; + // 组件可选项(适用于select,radio,checkbox组件) + options?: Array<{ + label: string; + value: any; + disabled?: boolean; + [key: string]: any; + }>; + // 插槽名(适用于组件类型为custom) + slotName?: string; + // 标签文本 + label: string; + // 标签提示 + tips?: string; + // 键名 + prop: string; + // 验证规则 + rules?: FormItemRule[]; + // 初始值 + initialValue?: any; + // 是否隐藏 + hidden?: boolean; + // 监听函数 + watch?: (newValue: any, oldValue: any, data: T) => void; +}>;