Element ui怎么自定义表头修改表头样式
在用element的table 表格的时候经常会遇到表头的样式很多,比如
点击表头就会出现提示文字
代码如下:
<el-table>
<el-table-column label="我的世界" :render-header="renderHeader"/>
</el-table>
renderHeader(h,{column}){
return h('div', [
h('span', column.label),
h('el-tooltip',{
props:{
effect: 'dark',
content:"Top Left 提示文字",
placement:'top-start',
},
},
[h('i', {
class:'el-icon-question',
style:'color:#000;margin-left:5px;cursor:pointer;',
})]
)
])
}
如果需要添加事件:
renderHeader(h,{column}){
return h('div', [
h('span', column.label),
h('el-tooltip',{
props:{
effect: 'dark',
content:"Top Left 提示文字",
placement:'top-start',
},
},
[h('i', {
class:'el-icon-question',
style:'color:#000;margin-left:5px;cursor:pointer;',
on:{
click:function(){
alert(456);
}
}
})]
)
])
}