style(table): 完善ts定义

This commit is contained in:
roymondchen 2024-03-13 19:55:45 +08:00
parent 523545ec7e
commit 38145ff461

View File

@ -33,7 +33,7 @@ export interface ColumnActionConfig {
action?: (data: { data: any }) => void; action?: (data: { data: any }) => void;
} }
export type ColumnConfig = { export interface ColumnConfig<T = any> {
form?: FormConfig; form?: FormConfig;
rules?: any; rules?: any;
values?: FormValue; values?: FormValue;
@ -43,12 +43,12 @@ export type ColumnConfig = {
fixed?: 'left' | 'right' | boolean; fixed?: 'left' | 'right' | boolean;
width?: number | string; width?: number | string;
actions?: ColumnActionConfig[]; actions?: ColumnActionConfig[];
type?: 'popover' | 'expand' | 'component' | string | ((value: any, row: any) => string); type?: 'popover' | 'expand' | 'component' | string | ((value: any, row: T) => string);
text?: string; text?: string;
prop?: string; prop?: string;
showHeader?: boolean; showHeader?: boolean;
table?: ColumnConfig[]; table?: ColumnConfig[];
formatter?: 'datetime' | ((item: any, row: Record<string, any>) => any); formatter?: 'datetime' | ((item: any, row: T) => any);
popover?: { popover?: {
placement: string; placement: string;
width: string; width: string;
@ -57,9 +57,9 @@ export type ColumnConfig = {
}; };
sortable?: boolean | 'custom'; sortable?: boolean | 'custom';
action?: 'tip' | 'actionLink' | 'img' | 'link' | 'tag'; action?: 'tip' | 'actionLink' | 'img' | 'link' | 'tag';
handler?: (row: any) => void; handler?: (row: T) => void;
/** 当type为expand时有效展开为html */ /** 当type为expand时有效展开为html */
expandContent?: (row: any, prop?: string) => string; expandContent?: (row: T, prop?: string) => string;
/** 当type为expand时展开为vue组件当type为component时显示的组件 */ /** 当type为expand时展开为vue组件当type为component时显示的组件 */
component?: any; component?: any;
/** 当type为expand时展开的vue组件props当type为component时显示的组件的props */ /** 当type为expand时展开的vue组件props当type为component时显示的组件的props */
@ -68,4 +68,4 @@ export type ColumnConfig = {
listeners?: any; listeners?: any;
/** 当type为tip时有效显示文案 */ /** 当type为tip时有效显示文案 */
buttonText?: string; buttonText?: string;
}; }