美文网首页
Vue --自定义el-table-column头部的两种方法

Vue --自定义el-table-column头部的两种方法

作者: 橙_知足常乐 | 来源:发表于2021-02-07 10:46 被阅读0次

第一种方法:会出现警告 [Element Warn][TableColumn]Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header.

1.在<el-table-column>上定义:render-header调用自定义表头方法,如图举例

2.在methods:{}方法里面自定义表头方法,如图举例

第二种方法: 使用scoped-slot(更简单且简洁无警告)

1.在<el-table-column>上使用scoped-slot

2.<template>绑定slot,然后自定义你所需要的内容

如图举例

相关文章