diff --git a/packages/effects/plugins/src/vxe-table/index.ts b/packages/effects/plugins/src/vxe-table/index.ts index a19f2b8fc..6f0efe442 100644 --- a/packages/effects/plugins/src/vxe-table/index.ts +++ b/packages/effects/plugins/src/vxe-table/index.ts @@ -1,5 +1,5 @@ export { setupVbenVxeTable } from './init'; -export type { VxeTableGridOptions } from './types'; +export type { VxeTableGridColumns, VxeTableGridOptions } from './types'; export * from './use-vxe-grid'; export { default as VbenVxeGrid } from './use-vxe-grid.vue'; diff --git a/packages/effects/plugins/src/vxe-table/types.ts b/packages/effects/plugins/src/vxe-table/types.ts index 8b9aea47d..8e56ce418 100644 --- a/packages/effects/plugins/src/vxe-table/types.ts +++ b/packages/effects/plugins/src/vxe-table/types.ts @@ -26,6 +26,8 @@ interface ToolbarConfigOptions extends VxeGridPropTypes.ToolbarConfig { search?: boolean; } +export type VxeTableGridColumns = VxeTableGridOptions['columns']; + export interface VxeTableGridOptions extends VxeTableGridProps { /** 工具栏配置 */ toolbarConfig?: ToolbarConfigOptions; @@ -40,6 +42,10 @@ export interface VxeGridProps< T extends Record = any, D extends BaseFormComponentType = BaseFormComponentType, > { + /** + * 数据 + */ + tableData?: any[]; /** * 标题 */ diff --git a/playground/src/views/system/dept/data.ts b/playground/src/views/system/dept/data.ts index 48773625a..b0699e7a6 100644 --- a/playground/src/views/system/dept/data.ts +++ b/playground/src/views/system/dept/data.ts @@ -1,4 +1,4 @@ -import type { VxeTableGridOptions } from '@vben/plugins/vxe-table'; +import type { VxeTableGridColumns } from '@vben/plugins/vxe-table'; import type { VbenFormSchema } from '#/adapter/form'; import type { OnActionClickFn } from '#/adapter/vxe-table'; @@ -76,7 +76,7 @@ export function useSchema(): VbenFormSchema[] { */ export function useColumns( onActionClick?: OnActionClickFn, -): VxeTableGridOptions['columns'] { +): VxeTableGridColumns { return [ { align: 'left', diff --git a/playground/src/views/system/menu/data.ts b/playground/src/views/system/menu/data.ts index 75190b4ac..11aa2bd37 100644 --- a/playground/src/views/system/menu/data.ts +++ b/playground/src/views/system/menu/data.ts @@ -1,4 +1,4 @@ -import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { OnActionClickFn, VxeTableGridColumns } from '#/adapter/vxe-table'; import type { SystemMenuApi } from '#/api/system/menu'; import { $t } from '#/locales'; @@ -23,7 +23,7 @@ export function getMenuTypeOptions() { export function useColumns( onActionClick: OnActionClickFn, -): VxeTableGridOptions['columns'] { +): VxeTableGridColumns { return [ { align: 'left', diff --git a/playground/src/views/system/role/data.ts b/playground/src/views/system/role/data.ts index 255b6cc72..9c9d0fbab 100644 --- a/playground/src/views/system/role/data.ts +++ b/playground/src/views/system/role/data.ts @@ -1,5 +1,5 @@ import type { VbenFormSchema } from '#/adapter/form'; -import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { OnActionClickFn, VxeTableGridColumns } from '#/adapter/vxe-table'; import type { SystemRoleApi } from '#/api'; import { $t } from '#/locales'; @@ -77,7 +77,7 @@ export function useGridFormSchema(): VbenFormSchema[] { export function useColumns( onActionClick: OnActionClickFn, onStatusChange?: (newStatus: any, row: T) => PromiseLike, -): VxeTableGridOptions['columns'] { +): VxeTableGridColumns { return [ { field: 'name',