Appearance
EyTable表格(推荐使用)
常规演示
基础表格如下
api:设置一个promise并输出列表,默认会传入page、page_size作为参数,若需要修改字段和额外参数请见useTable详情
columns:设置列,基础字段为 title、 dataIndex、showType,用于展示对应的文字、字段和展示类型。详情
columns.showType: 设置表格类型,详情
不同renderKey类型演示
column.renderKey: 如下,不同的renderKey展示不同类型输入选项,默认为renderInput
column.customForm: form中若需要自定义插槽,则设置customForm:true此时插槽名称为对应的dataIndex
API
Attributes
| 成员 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| api | api 请求接口 | (data: unknown) => Promise<unknown> | () => {} |
| columns | 表格项设置 | EyColumnItem[] | [] |
| hooksConfig | userTable 的配置 | IUseTableOptions<any, any> | {} |
| tableProps | a-table 自带属性 | TableProps | {} |
ColumnItem
columns字段本身保留了ant-design-vue中table里columns的所有字段,以下是对一些特殊字段的说明
此处会有较多字段,是为了降低使用者心智负担将form中字段集成于此,当showType为form或者both时可以当作使用ey-form的item配置
| 成员 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| renderKey | 表单要渲染的元素 | renderKey | — |
| formatter | 要转化输出的值 | formatterKey | ((data: unknown) => unknown) | — |
| formProps | 对应 ant-design-vue 中 form-item 的值 | FormItemProps | — |
| options | ey-select 中的 options 选项,同 el-props.options | SelectProps['options'] | — |
| component | 渲染的组件类型 | string | Component | — |
| elProps | 对于 renderKey 元素的属性 | T | — |
| colProps | grid 布局时可使用 | ColProps | — |
| colDouble | 默认布局时使用双倍的 col 值 | boolean | — |
| depend | formitem 的依赖项 | (FormGroupItemDepend: TFormGroupItemDepend, deps: unknown[]) => void | — |
| showType | 当前项展示的类型 | 'column' | 'form' | 'both' | — |
| title | 必填选项,对应的 form.label 或表格显示 | string | — |
| dataIndex | 必填选项,对应的 form.value 或表格字段 | string | — |
| customForm | 自定义 form 插槽 | boolean | — |
