Element ui怎么自定义表头修改表头样式

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);
              	}
              }
            })]
          )
        ])
      }
发布了34 篇原创文章 · 获赞 5 · 访问量 2253

猜你喜欢

转载自blog.csdn.net/tanfei_/article/details/103721584