elementui样式修改

el-table
html 复制代码
 <el-table
             border
             :data="tableData"
             :header-cell-style="{backgroundColor:'#D1E8FD',textAlign:'center',borderColor:'#D7D7D7',padding:0,height:'38px'}"
             :row-class-name="tableRowClassName"
             :cell-style="{textAlign:'center',padding:0,fontSize:'12px'}"
             :row-style="{height:'36px'}"
             style="width: 100%">
             </el-table>

修改表头: 设置:header-cell-style : 修改背景颜色,表头的高度

修改表行颜色: :row-class-name : 根据rowIndex 返回不同的样式 ===》 这个样式不能在scope下,不然会不生效

修改表行高度: 设置:cell-style的padding和 :row-style的height

:header-cell-style : 可以写一个函数,返回对应的style对象,,

js 复制代码
  /**
     *
     * @param row  所有的 header cell
     * @param column 每一个column
     * @param rowIndex 行号
     * @param columnIndex 列号
     */
    headerCellStyle({row,rowIndex,columnIndex}){

    let styleObj = {textAlign:'center',backgroundColor:'#FAFAFA',borderTop:"1px solid #E8E8E8"}
      console.log(row,columnIndex,typeof row)
      if (columnIndex === 0){
        return {...styleObj,borderLeft: "1px solid #E8E8E8"}
      }
      if (columnIndex === row.length-1){
        return {...styleObj,borderRight: "1px solid #E8E8E8"}
      }
      return styleObj
    }

引用:https://blog.csdn.net/qq_38950919/article/details/81056447

el-pagination

全局引入这个css:

css 复制代码
/* 跳转的样式*/
 .el-pagination .el-pagination__jump{
  margin-left: 0;
}
/*
// page-sizes选择器
//::v-deep .el-select-dropdown__item li{
  //  background-color:red !important;
  //}
*/
/* prev和next箭头的样式*/
.el-pagination .btn-next,
.el-pagination .btn-prev{
     background:transparent !important;
     background-color:transparent !important;
     border: 1px solid #e8e8e8;
   }
/* prev和next箭头disabled的样式
//::v-deep .el-pagination button:disabled {
  //  background-color:transparent !important;
  //}
 */
/* 页码样式*/
   .el-pager li{
       background-color:#fff !important;
       border: 1px solid #e8e8e8;
       border-radius: 4px !important;
     }
/*active的页码样式*/
  .el-pager li.active{
     color: #fff !important;
     background-color:#008AC4 !important;
   }

修改el-pagination文字:

js 复制代码
document.getElementsByClassName("el-pagination__jump")[0].childNodes[0].nodeValue = "跳转";

引用:https://zhuanlan.zhihu.com/p/349079144

el-pagination样式修改:

css 复制代码
// page-sizes选择器
::v-deep .el-select-dropdown__item li{
  background-color:transparent !important;
}
// prev和next箭头的样式
::v-deep .el-pagination .btn-next,
::v-deep .el-pagination .btn-prev{
  background:transparent !important;
  background-color:transparent !important;
}
// prev和next箭头disabled的样式
::v-deep .el-pagination button:disabled {
  background-color:transparent !important;
}
// 页码样式
::v-deep .el-pager li{
  background-color:transparent !important;
}
// active的页码样式
::v-deep .el-pager li.active{
  color: #267aff !important;
}

引用:https://blog.csdn.net/kirinlau/article/details/129166785

相关推荐
qq_433502184 分钟前
Codex cli 飞书文档创建进阶实用命令 + Skill 创建&使用 小白完整教程
java·前端·飞书
IT_陈寒10 分钟前
为什么我的Vite热更新老是重新加载整个页面?
前端·人工智能·后端
一袋米扛几楼9828 分钟前
【网络安全】SIEM -Security Information and Event Management 工具是什么?
前端·安全·web安全
小陈工40 分钟前
2026年4月7日技术资讯洞察:下一代数据库融合、AI基础设施竞赛与异步编程实战
开发语言·前端·数据库·人工智能·python
Cobyte1 小时前
3.响应式系统基础:从发布订阅模式的角度理解 Vue2 的数据响应式原理
前端·javascript·vue.js
竹林8181 小时前
从零到一:在React前端中集成The Graph查询Uniswap V3池数据实战
前端·javascript
Mintopia1 小时前
别再迷信"优化":大多数性能问题根本不在代码里
前端
倾颜1 小时前
接入 MCP,不一定要先平台化:一次 AI Runtime 的实战取舍
前端·后端·mcp
军军君011 小时前
Three.js基础功能学习十八:智能黑板实现实例五
前端·javascript·vue.js·3d·typescript·前端框架·threejs