el-table 样式修改 背景色透明 自动循环滚动 滚动条隐藏 表单和表头字体放大加粗

<div class="user_skills">
          <el-table :header-cell-style="{background:'transparent', fontSize: '30px',color:'#FFFFFF'}"
                    :data="dataList"
                    :cell-class-name="getCellClass" :cell-style="cellStyle"
                    :max-height="250"
                    ref="scroll_Table"
                    @mouseenter.native="autoScroll(true)"
                    @mouseleave.native="autoScroll(false)"
                    :row-style="{height:'60px'}"
                    style="font-size: 36px;font-weight: 600"
          >
            <el-table-column prop="directive" label="指令单"></el-table-column>
          </el-table>
        </div>

    // 设置自动滚动
    autoScroll(stop) {
      const table = this.$refs.scroll_Table
      // 拿到表格中承载数据的div元素
      const divData = table.$refs.bodyWrapper
      // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
      if (stop) {
        //再通过事件监听,监听到 组件销毁 后,再执行关闭计时器。
        window.clearInterval(this.scrolltimer)
      } else {
        this.scrolltimer = window.setInterval(() => {
          // 元素自增距离顶部1像素
          divData.scrollTop += 1
          // 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
          if (divData.clientHeight + divData.scrollTop == divData.scrollHeight) {
            // 重置table距离顶部距离
            divData.scrollTop = 0
            // 重置table距离顶部距离。值=(滚动到底部时,距离顶部的大小) - 整个高度/2
            // divData.scrollTop = divData.scrollTop - divData.scrollHeight / 2
          }
        }, 150) // 滚动速度
      }
    }


.user_skills {
  width: 1686px;
  height: 320px;
  // 设置表头字体粗细
  ::v-deep .el-table th .cell {
    font-weight: normal
  }
  ::v-deep .white-text {
    color: #ffffff;
  }
  ::v-deep .red-text {
    color: red;
  }
  ::v-deep .el-table, .el-table__expanded-cell {
    background-color: transparent; // 表格背景透明
  }
  ::v-deep .el-table::before {
    height: 0px; // 去除表格底部白线
  }
  //去除表格每一行的下标线;
  ::v-deep .el-table td {
    border-bottom: none;
  }
  //去除表头的下标线;
  ::v-deep .el-table th.is-leaf {
    border-bottom: none;
  }
  ::v-deep .el-table__body tr:hover > td {
    background-color: transparent !important;
  }
  ::v-deep .el-table tr {
    background-color: transparent !important;
  }
  ::v-deep .el-table--enable-row-transition .el-table__body td, .el-table .cell {
    background-color: transparent;
  }
  ::v-deep .el-table .cell {
    line-height: 36px
  }
  // 隐藏滚动条
  ::v-deep .el-table__body-wrapper::-webkit-scrollbar{
    /*width: 0;宽度为0隐藏*/
    width: 0px;
  }
  ::v-deep  .el-table th.gutter{
    display: none;
    width:0
  }
  ::v-deep  .el-table colgroup col[name='gutter']{
    display: none;
    width: 0;
  }
  ::v-deep  .el-table__body{
    width: 100% !important;
  }
}

  • 9
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值