el-table 自定义表头

<el-table-column prop="changeNum" label="领跑/落后品类" align="center" :render-header="renderheader">
  <template slot-scope="scope">
    <span>{{scope.row.change==1?'领跑':'落后'}} {{scope.row.changeNum}}span>
  template>
el-table-column>
 
  
表头添加一个图标,鼠标移入显示注释
renderheader(h, { column, $index }) {
  return h('span', {}, [
    h('span', {}, column.label),
    h('el-popover', { props: { placement: 'top-start', width: '200', trigger: 'hover', content: '领先/落后品类=单店平均单量-该品类城市店均单量' }}, [
      h('svg-icon', { slot: 'reference', props: { iconClass: 'zhushi' }}, '')
    ])
  ])
},

你可能感兴趣的:(el-table 自定义表头)