# 案例
提示
调用columnsHelper
方法,返回配置实例,可以通过链式调用方法的方式来构建vxe-grid
的列配置。实例大部分方法名与vxe-grid
的列配置属性一致(封装工具时的 3.9 版本),少数调整。
# 新增的
# merge 合并配置
merge
实例方法用于合并配置(需为columnsHelper
创建的实例)。
如,columns-examples-merge.js
文件中定义了一些通用列配置,在以下案例中,通过merge
方法来合并到当前实例中。
columns-examples-merge.js
// columns-examples-merge.js
import { columnsHelper } from 'vxe-table-middleware';
const columns = columnsHelper();
columns.title('创建人').field('createUser').width('80px').end();
columns.title('创建时间').field('createTime').width('120px').end();
columns.title('更新人').field('updateUser').width('80px').end();
columns.title('更新时间').field('updateTime').width('120px').end();
export default columns;
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
somePage.vue
复制
# end
注意
end
实例方法用于结束每一列的配置,在链式最后调用,否则列配置会发生异常!!!。
# 调整的
align
、headerAlign
、footerAlign
合并为align
方法,header 和 footer 的配置作为 align 方法的第二个对象参数;showOverflow
、showHeaderOverflow
、showFooterOverflow
合并为showOverflow
方法,header 和 footer 的配置作为 showOverflow 方法的第二个对象参数;className
、headerClassName
、footerClassName
合并为className
方法,header 和 footer 的配置作为 className 方法的第二个对象参数;sortable
、sortBy
、sortType
合并为sort
方法;filterMultiple
作为filters
方法的第二个参数;filterRender
、cellRender
、editRender
、contentRender
方法第一个参数为渲染器名称,第二个参数为配置对象;params
方法参数只允许对象类型;titlePrefix
、titleSuffix
方法参数拦截useHTML
配置。
复制