Element UI el-table 设置每个 el-table-column 的高度
要设置每个 el-table-column 的高度,可以使用 scoped-slot 来自定义每个单元格的内容,并在其中设置高度。
首先,在 el-table-column 中添加一个 scoped-slot,例如:
<el-table-column prop='name' label='Name'>
<template slot-scope='scope'>
<div class='cell' style='height: 50px;'>{{ scope.row.name }}</div>
</template>
</el-table-column>
在上面的代码中,我们在 scoped-slot 中添加了一个 div 元素,并设置其高度为 50px。你可以根据需要设置不同的高度。
另外,你还可以使用 CSS 来为每个单元格设置高度。在 el-table-column 中添加一个自定义的 class,并使用 CSS 来设置高度,例如:
<el-table-column prop='name' label='Name' class-name='custom-column'>
</el-table-column>
.custom-column .cell {
height: 50px;
}
在上面的代码中,我们为 el-table-column 添加了一个自定义的 class 名为 'custom-column',然后使用 CSS 来为该 class 下的 .cell 元素设置高度为 50px。
这两种方法都可以用来设置每个 el-table-column 的高度,你可以根据自己的需求选择使用哪种方法。
原文地址: https://www.cveoy.top/t/topic/fAvL 著作权归作者所有。请勿转载和采集!