From 19b145597e775e9432472026374184b8d7d23fa5 Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Tue, 26 Nov 2024 10:49:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=9F=E4=B8=80=20vxe-table=20?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/table/vxe-table/index.vue | 67 +++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/src/pages/table/vxe-table/index.vue b/src/pages/table/vxe-table/index.vue index fdcb87af..0efde331 100644 --- a/src/pages/table/vxe-table/index.vue +++ b/src/pages/table/vxe-table/index.vue @@ -40,14 +40,20 @@ const xGridOpt: VxeGridProps = reactive({ field: "username", itemRender: { name: "$input", - props: { placeholder: "用户名", clearable: true } + props: { + placeholder: "用户名", + clearable: true + } } }, { field: "phone", itemRender: { name: "$input", - props: { placeholder: "手机号", clearable: true } + props: { + placeholder: "手机号", + clearable: true + } } }, { @@ -55,10 +61,17 @@ const xGridOpt: VxeGridProps = reactive({ name: "$buttons", children: [ { - props: { type: "submit", content: "查询", status: "primary" } + props: { + type: "submit", + content: "查询", + status: "primary" + } }, { - props: { type: "reset", content: "重置" } + props: { + type: "reset", + content: "重置" + } } ] } @@ -69,7 +82,9 @@ const xGridOpt: VxeGridProps = reactive({ toolbarConfig: { refresh: true, custom: true, - slots: { buttons: "toolbar-btns" } + slots: { + buttons: "toolbar-btns" + } }, /** 自定义列配置项 */ customConfig: { @@ -114,7 +129,9 @@ const xGridOpt: VxeGridProps = reactive({ width: "150px", fixed: "right", showOverflow: false, - slots: { default: "row-operate" } + slots: { + default: "row-operate" + } } ], /** 数据代理配置项(基于 Promise API) */ @@ -135,7 +152,7 @@ const xGridOpt: VxeGridProps = reactive({ return new Promise((resolve) => { let total = 0 let result: RowMeta[] = [] - /** 加载数据 */ + // 加载数据 const callback = (res: TableResponseData) => { if (res?.data) { // 总数 @@ -147,8 +164,7 @@ const xGridOpt: VxeGridProps = reactive({ // 返回值有格式要求,详情见 vxe-table 官方文档 resolve({ total, result }) } - - /** 接口需要的参数 */ + // 接口需要的参数 const params = { username: form.username || undefined, phone: form.phone || undefined, @@ -196,22 +212,45 @@ const xFormOpt: VxeFormProps = reactive({ { field: "username", title: "用户名", - itemRender: { name: "$input", props: { placeholder: "请输入" } } + itemRender: { + name: "$input", + props: { + placeholder: "请输入" + } + } }, { field: "password", title: "密码", - itemRender: { name: "$input", props: { placeholder: "请输入" } } + itemRender: { + name: "$input", + props: { + placeholder: "请输入" + } + } }, { align: "right", itemRender: { name: "$buttons", children: [ - { props: { content: "取消" }, events: { click: () => xModalDom.value?.close() } }, { - props: { type: "submit", content: "确定", status: "primary" }, - events: { click: () => crudStore.onSubmitForm() } + props: { + content: "取消" + }, + events: { + click: () => xModalDom.value?.close() + } + }, + { + props: { + type: "submit", + content: "确定", + status: "primary" + }, + events: { + click: () => crudStore.onSubmitForm() + } } ] }