From c92d6a2b1db0cdfbafbf03c58f19ac614d3d62d9 Mon Sep 17 00:00:00 2001
From: dap <15891557205@163.com>
Date: Thu, 7 Aug 2025 20:31:41 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20vxe/antd=E5=8F=AF=E7=BC=96=E8=BE=91?=
=?UTF-8?q?=E8=A1=A8=E6=A0=BC=E9=80=82=E9=85=8D=E5=99=A8=20&=20=E5=8F=AF?=
=?UTF-8?q?=E7=BC=96=E8=BE=91demo?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../views/演示使用自行删除/vxe/edit-table.vue | 121 +++++++++++++-----
packages/effects/plugins/package.json | 1 +
.../effects/plugins/src/vxe-table/init.ts | 12 ++
3 files changed, 104 insertions(+), 30 deletions(-)
diff --git a/apps/web-antd/src/views/演示使用自行删除/vxe/edit-table.vue b/apps/web-antd/src/views/演示使用自行删除/vxe/edit-table.vue
index 2c285f51..d1fdcec3 100644
--- a/apps/web-antd/src/views/演示使用自行删除/vxe/edit-table.vue
+++ b/apps/web-antd/src/views/演示使用自行删除/vxe/edit-table.vue
@@ -4,7 +4,6 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
import { nextTick, onMounted } from 'vue';
import { JsonPreview } from '@vben/common-ui';
-import { getPopupContainer } from '@vben/utils';
import {
Button,
@@ -18,6 +17,16 @@ import {
import { useVbenVxeGrid } from '#/adapter/vxe-table';
+/**
+ * 与antdv集成 可以参考这里使用自定义插槽
+ * https://vxetable.cn/other4/#/table/other/antd
+ */
+
+const options = ['前端佬', '后端佬', '组长'].map((item) => ({
+ label: item,
+ value: item,
+}));
+
const gridOptions: VxeGridProps = {
editConfig: {
// 触发编辑的方式
@@ -32,12 +41,19 @@ const gridOptions: VxeGridProps = {
},
checkboxConfig: {},
editRules: {
- name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
+ name: [{ required: true, message: '请输入姓名' }],
age: [
- { required: true, message: '请输入年龄', trigger: 'blur' },
- { min: 0, max: 200, message: '年龄必须为1-200' },
+ { required: true, message: '请输入年龄' },
+ { type: 'number', min: 0, max: 200, message: '年龄必须为1-200' },
+ ],
+ job: [{ required: true, message: '请选择工作' }],
+ phone: [
+ {
+ required: true,
+ message: '请输入正确的手机号',
+ pattern: /^1[3-9]\d{9}$/,
+ },
],
- job: [{ required: true, message: '请选择工作', trigger: 'blur' }],
},
columns: [
{
@@ -61,8 +77,16 @@ const gridOptions: VxeGridProps = {
}
return {row.name};
},
- edit: ({ row }) => {
- return ;
+ edit: (props) => {
+ const { row, $grid } = props;
+
+ return (
+ $grid?.updateStatus(props)}
+ placeholder={'请输入'}
+ v-model:value={row.name}
+ />
+ );
},
},
},
@@ -78,10 +102,12 @@ const gridOptions: VxeGridProps = {
}
return {row.age};
},
- edit: ({ row }) => {
+ edit: (props) => {
+ const { row, $grid } = props;
return (
$grid?.updateStatus(props)}
placeholder={'请输入'}
v-model:value={row.age}
/>
@@ -90,8 +116,8 @@ const gridOptions: VxeGridProps = {
},
},
{
- field: '工作',
- title: 'job',
+ field: 'job',
+ title: '工作',
align: 'left',
editRender: {},
slots: {
@@ -101,15 +127,14 @@ const gridOptions: VxeGridProps = {
}
return {row.job};
},
- edit: ({ row }) => {
- const options = ['前端佬', '后端佬', '组长'].map((item) => ({
- label: item,
- value: item,
- }));
+ edit: (props) => {
+ const { row, $grid } = props;
+
return (