Table组件columns增加泛型

This commit is contained in:
抠脚本人
2023-07-28 11:39:35 +08:00
parent 9d18715e90
commit ee0e507e47
4 changed files with 19 additions and 10 deletions

View File

@@ -4,7 +4,7 @@ import { provide, inject, ComputedRef } from 'vue';
const key = Symbol('s-table');
type Instance = TableActionType & {
type Instance = TableActionType<{}> & {
wrapRef: Ref<Nullable<HTMLElement>>;
getBindValues: ComputedRef<Recordable>;
};

View File

@@ -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<T> extends TableBaseColumn<T> {
//编辑表格
edit?: boolean;
editRow?: boolean;
@@ -13,16 +13,16 @@ export interface BasicColumn extends TableBaseColumn {
// 权限编码控制是否显示
auth?: string[];
// 业务控制是否显示
ifShow?: boolean | ((column: BasicColumn) => boolean);
ifShow?: boolean | ((column: BasicColumn<T>) => boolean);
// 控制是否支持拖拽,默认支持
draggable?: boolean;
}
export interface TableActionType {
export interface TableActionType<T> {
reload: (opt) => Promise<void>;
emit?: any;
getColumns: (opt?) => BasicColumn[];
setColumns: (columns: BasicColumn[] | string[]) => void;
getColumns: (opt?) => BasicColumn<T>[];
setColumns: (columns: BasicColumn<T>[] | string[]) => void;
}
export interface BasicTableProps {