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