el-table中使用v-for循环出表头以后border无效
时间: 2023-12-30 17:04:19 浏览: 80
你可以尝试在 `el-table` 组件中添加 `border` 属性来设置边框,例如:
```html
<el-table :data="tableData" border>
<el-table-column v-for="item in tableColumns" :key="item.prop" :prop="item.prop" :label="item.label">
</el-table-column>
</el-table>
```
确保 `border` 属性设置在 `el-table` 组件上,而不是在 `el-table-column` 组件上。这样应该能够正确地显示边框。如果问题仍然存在,请提供更多的代码和详细描述,以便我可以更好地帮助你解决问题。
相关问题
<el-table :data="tableData" :row-key="rowKey" border :tree-props="{children: 'children'}" :cell-class-name="dianClass" @cell-click="seeDetail" :header-cell-style="{background:'#f0f0f0'}"> <el-table-column width="50"></el-table-column> <el-table-column align="center" type="index" label="序号"> <template slot-scope="scope">{{ scope.$index + 1 }}</template> </el-table-column> <el-table-column align="center" prop="name" label="工程名称"></el-table-column> <el-table-column align="center" prop="code" label="工程编码"></el-table-column> <el-table-column align="center" prop="startDate" label="实际开工时间" :formatter="TimeFor"></el-table-column> <el-table-column align="center" prop="su" label="执行中的风险作业(A/B票)"></el-table-column> <el-table-column align="center" prop="ballNumber" label="布控球台数"></el-table-column> <el-table-column align="center" prop="toa" label="工程进度"></el-table-column> </el-table>
蓝色'}">这段代码的作用是什么?
这段代码是用来渲染一个表格的,其中包括以下几个属性:
- data:表格的数据源,即要展示的数据。
- row-key:表格行的唯一标识符,用于优化表格的渲染性能。
- border:是否显示表格的边框。
- tree-props:用于渲染树形表格,指定树形结构的子节点属性名为'children'。
- cell-class-name:用于自定义单元格的类名,可以根据数据的不同来动态添加类名。
- cell-click:单元格点击事件,可以在点击单元格时执行相应的操作。
- header-cell-style:表头单元格的样式,可以自定义表头单元格的样式,如背景色等。
el-table 最后的表头取消border
您可以通过以下 CSS 代码来取消 `el-table` 最后一列的表头边框:
```css
.el-table__header-wrapper::after {
content: none;
}
```
这将删除表格头部的最后一列的边框。如果您想删除表格主体中最后一列的边框,可以使用以下 CSS 代码:
```css
.el-table__body-wrapper::after {
content: none;
}
```
这将删除表格主体的最后一列的边框。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)