vue修改Element的el-table样式的4种方法
修改Element中的el-table样式,可以使用以下几种方法:
1. row-style 行的 style 的回调方法,也可以使用一个固定的 Object 为所有行设置一样的 Style。
2. cell-style 单元格的 style 的回调方法,也可以使用一个固定的 Object 为所有单元格设置一样的 Style。
3. header-row-style 表头行的 style 的回调方法,也可以使用一个固定的 Object 为所有表头行设置一样的 Style。
4. header-cell-style 表头单元格的 style 的回调方法,也可以使用一个固定的 Object 为所有表头单元格设置一样的 Style。
示例代码如下:
<template> <div> <div style='width:700px;margin: 0 auto;'> <el-table :data='tableData' border stripe='true' :row- :header-cell- style='width: 100%'> <el-table-columnprop='tag'label='tag'width='150'> </el-table-column> <el-table-columnprop='confidence'label='confidence'width='180'> </el-table-column> <el-table-columnprop='category_tag_level'label='category_tag_level'> </el-table-column> </el-table> </div> </div></template><script> export default{ data () { return {tableData: [{ tag: ’体育’, confidence: ’0.8213628173213’, category_tag_level: ’123’}, { tag: ’体育’, confidence: ’0.8213628173213’, category_tag_level: ’123’}, { tag: ’体育’, confidence: ’0.8213628173213’, category_tag_level: ’123’}, { tag: ’体育’, confidence: ’0.8213628173213’, category_tag_level: ’123’}, { tag: ’体育’, confidence: ’0.8213628173213’, category_tag_level: ’123’}, { tag: ’体育’, confidence: ’0.8213628173213’, category_tag_level: ’123’}, { tag: ’体育’, confidence: ’0.8213628173213’, category_tag_level: ’123’}] } }, methods:{ //设置表格行的样式 tableRowStyle({row,rowIndex}){return ’background-color:pink;font-size:15px;’ }, //设置表头行的样式 tableHeaderColor({row,column,rowIndex,columnIndex}){return ’background-color:lightblue;color:#fff;font-wight:500;font-size:20px;text-align:center’ } } }</script><style></style>
效果如下所示:

以上就是vue修改Element的el-table样式的4种方法的详细内容,更多关于vue修改Element的el-table样式的资料请关注好吧啦网其它相关文章!
相关文章:
1. IntelliJ IDEA导出项目的方法2. IDEA下因Lombok插件产生的Library source does not match the bytecode报错问题及解决方法(亲测可用)3. Django中如何使用Channels功能4. docker容器调用yum报错的解决办法5. idea设置自动导入依赖的方法步骤6. 使用 kind 和 Docker 启动本地的 Kubernetes环境7. 关于html嵌入xml数据岛如何穿过树形结构关系的问题8. python的json包位置及用法总结9. intellij idea写Python教程10. ASP.NET MVC增加一条记录同时添加N条集合属性所对应的个体

网公网安备