diff --git a/src/components/Table/src/hooks/useTableContext.ts b/src/components/Table/src/hooks/useTableContext.ts index e975ac3..f9d8dee 100644 --- a/src/components/Table/src/hooks/useTableContext.ts +++ b/src/components/Table/src/hooks/useTableContext.ts @@ -4,7 +4,7 @@ import { provide, inject, ComputedRef } from 'vue'; const key = Symbol('s-table'); -type Instance = TableActionType & { +type Instance = TableActionType<{}> & { wrapRef: Ref>; getBindValues: ComputedRef; }; diff --git a/src/components/Table/src/types/table.ts b/src/components/Table/src/types/table.ts index edbb48f..6a9ee72 100644 --- a/src/components/Table/src/types/table.ts +++ b/src/components/Table/src/types/table.ts @@ -1,6 +1,6 @@ import type { TableBaseColumn } from 'naive-ui/lib/data-table/src/interface'; import { ComponentType } from './componentType'; -export interface BasicColumn extends TableBaseColumn { +export interface BasicColumn extends TableBaseColumn { //编辑表格 edit?: boolean; editRow?: boolean; @@ -13,16 +13,16 @@ export interface BasicColumn extends TableBaseColumn { // 权限编码控制是否显示 auth?: string[]; // 业务控制是否显示 - ifShow?: boolean | ((column: BasicColumn) => boolean); + ifShow?: boolean | ((column: BasicColumn) => boolean); // 控制是否支持拖拽,默认支持 draggable?: boolean; } -export interface TableActionType { +export interface TableActionType { reload: (opt) => Promise; emit?: any; - getColumns: (opt?) => BasicColumn[]; - setColumns: (columns: BasicColumn[] | string[]) => void; + getColumns: (opt?) => BasicColumn[]; + setColumns: (columns: BasicColumn[] | string[]) => void; } export interface BasicTableProps { diff --git a/src/views/list/basicList/columns.ts b/src/views/list/basicList/columns.ts index a4fe697..910b839 100644 --- a/src/views/list/basicList/columns.ts +++ b/src/views/list/basicList/columns.ts @@ -1,7 +1,16 @@ import { h } from 'vue'; import { NAvatar } from 'naive-ui'; - -export const columns = [ +import { BasicColumn } from '@/components/Table'; +export interface ListData { + id: string; + name: string; + avatar: string; + address: string; + beginTime: string; + endTime: string; + date: string; +} +export const columns: BasicColumn[] = [ { title: 'id', key: 'id', diff --git a/src/views/list/basicList/index.vue b/src/views/list/basicList/index.vue index af63d90..7b9db60 100644 --- a/src/views/list/basicList/index.vue +++ b/src/views/list/basicList/index.vue @@ -9,7 +9,7 @@