feat: @vben/plugins/vxe-table 异步导出 vxe-table 相关组件提供给需要单独使用 vxe-table 的场景

This commit is contained in:
puhui999
2025-05-09 13:09:24 +08:00
parent 62570fa745
commit 98676e1dc9
8 changed files with 118 additions and 14 deletions

View File

@@ -4,7 +4,11 @@ import { h } from 'vue';
import { IconifyIcon } from '@vben/icons';
import { $te } from '@vben/locales';
import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table';
import {
AsyncComponents,
setupVbenVxeTable,
useVbenVxeGrid,
} from '@vben/plugins/vxe-table';
import { isFunction, isString } from '@vben/utils';
import { Button, Image, Popconfirm, Switch } from 'ant-design-vue';
@@ -14,6 +18,8 @@ import { $t } from '#/locales';
import { useVbenForm } from './form';
import '#/adapter/style.css';
setupVbenVxeTable({
configVxeTable: (vxeUI) => {
vxeUI.setConfig({
@@ -111,6 +117,7 @@ setupVbenVxeTable({
loading: row[loadingKey] ?? false,
'onUpdate:checked': onChange,
};
async function onChange(newVal: any) {
row[loadingKey] = true;
try {
@@ -122,6 +129,7 @@ setupVbenVxeTable({
row[loadingKey] = false;
}
}
return h(Switch, finallyProps);
},
});
@@ -280,6 +288,10 @@ setupVbenVxeTable({
});
export { useVbenVxeGrid };
const [VxeTable, VxeColumn, VxeToolbar] = AsyncComponents;
export { VxeColumn, VxeTable, VxeToolbar };
// add by 芋艿from https://github.com/vbenjs/vue-vben-admin/blob/main/playground/src/adapter/vxe-table.ts#L264-L270
export type OnActionClickParams<T = Recordable<any>> = {
code: string;