-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: improve the usage documentation of vben-vxe-table (#4829)
* perf: improve the usage documentation of vben-vxe-table
- Loading branch information
Showing
31 changed files
with
720 additions
and
888 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,70 @@ | ||
import { h } from 'vue'; | ||
|
||
import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table'; | ||
|
||
import { Button, Image } from 'ant-design-vue'; | ||
|
||
import { useVbenForm } from './form'; | ||
|
||
if (!import.meta.env.SSR) { | ||
setupVbenVxeTable({ | ||
configVxeTable: (vxeUI) => { | ||
vxeUI.setConfig({ | ||
grid: { | ||
align: 'center', | ||
border: false, | ||
columnConfig: { | ||
resizable: true, | ||
}, | ||
|
||
formConfig: { | ||
// 全局禁用vxe-table的表单配置,使用formOptions | ||
enabled: false, | ||
}, | ||
minHeight: 180, | ||
proxyConfig: { | ||
autoLoad: true, | ||
response: { | ||
result: 'items', | ||
total: 'total', | ||
list: 'items', | ||
}, | ||
showActiveMsg: true, | ||
showResponseMsg: false, | ||
}, | ||
round: true, | ||
showOverflow: true, | ||
size: 'small', | ||
}, | ||
}); | ||
|
||
// 表格配置项可以用 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const useVbenForm = () => {}; | ||
export const z = {}; | ||
export type VbenFormSchema = any; | ||
export type VbenFormProps = any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export type * from '@vben/plugins/vxe-table'; | ||
|
||
export const useVbenVxeGrid = () => {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.