---
title: API
order: 6
docGenIncludes:
  - src/components/YwTable/index.tsx
---

```ts

export type ColumnItem = {
  /** 标题 */
  title: string | React.ReactNode;
  /** 字段 */
  dataIndex: string;
  width?: number;
  /** 组件 */
  component?:
    | 'MultipleCol'
    | 'Time'
    | 'Person'
    | 'Operates'
    | 'Status'
    | 'Tags'
    | 'DetailInfo'
    | 'LongText2Ellipsis';
  /** 组件入参 */
  componentProps?: object;
  /** 组件入参 */
  render?: ()=>{};
};
export type ButtonItem = {
  children?: string | React.ReactNode;
  btnText: string;
  btnType?: string;
  type: 'batch' | 'action';
  disabled?: boolean | Function;
  visible?: boolean | Function;
  onClick?: Function;
};

export interface YwTableProps<SearchProps, dataSourceProps> extends TableProps<dataSourceProps> {
  // /** 是否多行渲染 默认单行 */
  // multiple: boolean;
  // /** 固定表头 */
  // stickyHeader?: boolean;
  /** Table列信息 同 antd columns*/
  columns: Array<ColumnItem>;
  /** 操作区配置项  */
  buttons?: Array<ButtonItem>;
  /** 表格筛选入参  */
  filterProps?: SearchProps;
  /** 获取数据 */
  getTableData: (
    params: SearchProps & { pageIndex: number; pageSize: number },
  ) => Promise<{ totalNumber: number; pageIndex: number; pageSize: number; list: dataSourceProps }>;
}

// 方法
// reload 重新加载（当前页）
// refresh 刷新（回到第一页）
```