
element table 表头文字对齐
想要在 element table 中对齐不同长度的表头文字,可以尝试使用自定义插槽:
<el-table-column
width="45"
:label="citem.name"
v-show="item.children.length"
v-for="(citem, cindex) in item.children"
:key="cindex"
align="center"
>
<template slot-scope="scope">
{{ scope.row.dataList[citem.index].count }}
</template>
<template slot="header">
<div v-html="citem.name"></div>
</template>
</el-table-column>在 slot-header 中,使用 v-html 可以直接渲染 html 内容,从而控制表头文字的格式。通过这种方式,可以将两个字与四个字对齐。










