diff --git a/src/components/table/index.ts b/src/components/table/index.ts index 9874577..5bc490d 100644 --- a/src/components/table/index.ts +++ b/src/components/table/index.ts @@ -1,17 +1,17 @@ import { h } from 'vue'; -import type { ButtonProps, DataTableColumns } from 'naive-ui'; +import type { ButtonProps, DataTableColumn, DataTableColumns } from 'naive-ui'; import { NButton, NSpace } from 'naive-ui'; -import type { TableColumn } from 'naive-ui/es/data-table/src/interface'; +import type { InternalRowData } from 'naive-ui/es/data-table/src/interface'; import type { safeClient } from '@/service/api'; import type TableBase from './table-base.vue'; -export type TableBaseColumns = Array< - TableColumn & { - operations?: (row: T) => Array & { contentText: string }>; - key: string; - title: string; - } ->; +type TableBaseColumn = DataTableColumn & { + operations?: (row: T) => Array & { contentText: string }>; + key: string; + title: string; +}; + +export type TableBaseColumns = Array>; export type TableInst = InstanceType; @@ -22,7 +22,7 @@ export interface Pagination { export type TableFetchData = (page: Pagination) => ReturnType; -export function transformColumns(columns: TableBaseColumns): DataTableColumns { +export function transformColumns(columns: TableBaseColumns): DataTableColumns { return columns.map(col => { return { ...col, @@ -31,8 +31,8 @@ export function transformColumns(columns: TableBaseColumns): DataTab h(NSpace, null, { default: () => col.operations!(row).map(item => h(NButton, item, { default: () => item.contentText })) }) - : undefined - } as TableColumn; + : (col as any).render + } as TableBaseColumn; }); } diff --git a/src/views/withdraw/fiat/index.vue b/src/views/withdraw/fiat/index.vue index 85152a8..f6b3ef5 100644 --- a/src/views/withdraw/fiat/index.vue +++ b/src/views/withdraw/fiat/index.vue @@ -23,7 +23,7 @@ const columns: TableBaseColumns = [ title: '操作', fixed: 'right', key: 'operation', - operations: (row: any) => [ + operations: row => [ { contentText: '处理', type: 'primary',