Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
70 lines
1.7 KiB
TypeScript
70 lines
1.7 KiB
TypeScript
import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
|
||
|
||
import { h } from 'vue';
|
||
|
||
import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table';
|
||
|
||
import { Button, Image } from 'ant-design-vue';
|
||
|
||
import { useVbenForm } from './form';
|
||
|
||
setupVbenVxeTable({
|
||
configVxeTable: (vxeUI) => {
|
||
vxeUI.setConfig({
|
||
grid: {
|
||
align: 'center',
|
||
border: false,
|
||
columnConfig: {
|
||
resizable: true,
|
||
},
|
||
minHeight: 180,
|
||
formConfig: {
|
||
// 全局禁用vxe-table的表单配置,使用formOptions
|
||
enabled: false,
|
||
},
|
||
proxyConfig: {
|
||
autoLoad: true,
|
||
response: {
|
||
result: 'items',
|
||
total: 'total',
|
||
list: 'items',
|
||
},
|
||
showActiveMsg: true,
|
||
showResponseMsg: false,
|
||
},
|
||
round: true,
|
||
showOverflow: true,
|
||
size: 'small',
|
||
} as VxeTableGridOptions,
|
||
});
|
||
|
||
// 表格配置项可以用 cellRender: { name: 'CellImage' },
|
||
vxeUI.renderer.add('CellImage', {
|
||
renderTableDefault(_renderOpts, params) {
|
||
const { column, row } = params;
|
||
return h(Image, { src: row[column.field] });
|
||
},
|
||
});
|
||
|
||
// 表格配置项可以用 cellRender: { name: 'CellLink' },
|
||
vxeUI.renderer.add('CellLink', {
|
||
renderTableDefault(renderOpts) {
|
||
const { props } = renderOpts;
|
||
return h(
|
||
Button,
|
||
{ size: 'small', type: 'link' },
|
||
{ default: () => props?.text },
|
||
);
|
||
},
|
||
});
|
||
|
||
// 这里可以自行扩展 vxe-table 的全局配置,比如自定义格式化
|
||
// vxeUI.formats.add
|
||
},
|
||
useVbenForm,
|
||
});
|
||
|
||
export { useVbenVxeGrid };
|
||
|
||
export type * from '@vben/plugins/vxe-table';
|