You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

// 用于配置某些组件的常规配置,而无需修改组件
2 years ago
import type { SorterResult } from '../components/Table'
export default {
// 表格配置
2 years ago
table: {
// 表格接口请求通用配置,可在组件prop覆盖
// 支持 xxx.xxx.xxx格式
2 years ago
fetchSetting: {
// 传给后台的当前页字段
2 years ago
pageField: 'page',
// 传给后台的每页显示多少条的字段
2 years ago
sizeField: 'pageSize',
// 接口返回表格数据的字段
2 years ago
listField: 'items',
// 接口返回表格总数的字段
2 years ago
totalField: 'total'
},
// 可选的分页选项
2 years ago
pageSizeOptions: ['10', '50', '80', '100'],
// 默认每页显示多少条
2 years ago
defaultPageSize: 10,
// 默认排序方法
2 years ago
defaultSize: 'middle',
// 自定义通用排序功能
2 years ago
defaultSortFn: (sortInfo: SorterResult) => {
const { field, order } = sortInfo
if (field && order) {
return {
// 排序字段
2 years ago
field,
// 排序方式 asc/desc
2 years ago
order
}
} else {
return {}
}
},
// 自定义过滤方法
2 years ago
defaultFilterFn: (data: Partial<Recordable<string[]>>) => {
return data
}
},
// 滚动组件配置
2 years ago
scrollbar: {
// 是否使用原生滚动样式
// 开启后,菜单,弹窗,抽屉会使用原生滚动条组件
2 years ago
native: false
}
}