利用ElementUI的table和calendar制作一个价格日历

296 阅读1分钟

table表格需要增加提示文案说明,没有现成的属性添加,我们可以通过render-header来渲染表头。

代码如下:

<el-table-column
        align="center"
        label="价格"
        :render-header="renderTipsHeader"
      >
        <template slot-scope="scope">
          {{ scope.row.amount }}
        </template>
</el-table-column>

renderTipsHeader:

renderTipsHeader (h,{column}) {
      return h(
        'div',[ 
             h('span', column.label),
             h('el-tooltip',{
          props:{
        effect:'dark',
        content:'提示文案',
        placement:'top'
      },    
     },[
                 h('i', {
                     class:'el-icon-question',
                     style:'color:#409EFF;margin-left:5px;'
                 })
            ])
        ]
    );
 }

效果如图:

render-header 列标题 Label 区域渲染使用的 Function 
Function(h, { column, $index }) 

感兴趣可以打印出来看看,这里还有更复杂的应用--github.com/Darkerxi/El…


参考文章: element-ui自定义table表头,修改标题样式、添加tooltip及 :render-header使用简介