Vue Element 表头换行实现方法 - 使用 `<br>` 或 `white-space: pre-wrap`
如果表头内容过长,可以使用<br>标签或者white-space: pre-wrap样式来实现换行效果。
例如:
<el-table>
<el-table-column label='姓名'>
<template slot-scope='scope'>
姓:<span>{{ scope.row.firstName }}</span><br>
名:<span>{{ scope.row.lastName }}</span>
</template>
</el-table-column>
<el-table-column label='年龄' prop='age'></el-table-column>
</el-table>
.el-table th div {
white-space: pre-wrap;
}
这样就能实现表头的换行效果了。
原文地址: https://www.cveoy.top/t/topic/lGaJ 著作权归作者所有。请勿转载和采集!