修改el-table底部滚动条 添加右边滚动条

<template>
  <div class="dhc-table">
    <el-row>
      <el-col :span="16">
        <div class="table">
          <el-scrollbar style="height: 100%">
            <el-table :data="tableData" style="width: 100%">
              <el-table-column prop="org" label="机构" width="180">
              </el-table-column>
              <el-table-column prop="name" label="人员" width="180">
              </el-table-column>
              <el-table-column prop="car" label="车辆" width="180">
              </el-table-column>
              <el-table-column prop="date" label="日期" width="180">
              </el-table-column>
              <el-table-column prop="line" label="路线"> </el-table-column>
            </el-table>
          </el-scrollbar>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="tables">
          <el-scrollbar style="height: 100%">
            <div class="imgox">
              <div class="img">
                <img :src="require('@/assets/img/car.png')" alt="" />
              </div>
              <div class="img">
                <img :src="require('@/assets/img/car.png')" alt="" />
              </div>
                   <div class="img">
                <img :src="require('@/assets/img/car.png')" alt="" />
              </div>
            </div>
          </el-scrollbar>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
 <script>
export default {
  data() {
    return {
      tableData: [
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
        {
          org: "呼市第一大队",
          date: "2016-05-02",
          name: "王小虎",
          car: "蒙A12333",
          line: "S104下行K37",
        },
      ],
    };
  },
};
</script>
<style lang="scss" scoped>
.dhc-table {
  ::v-deep {
    .el-row {
      width: 100%;
      height: calc(100vh - 120px);
      background: #010f29;
    }
  }
}
.imgox {
  width: 100%;
  height: calc(100vh - 20px - 120px);
  padding: 10px;
  .img {
    width: 100%;
    img {
      width: 100%;
    }
  }
}
.table {
  height: calc(100vh - 20px - 120px);
  margin-top: 22px;
  margin-left: 20px;
  padding: 30px;
  background: url("~@/assets/img/tableBg.png") no-repeat center center;
  background-size: 100% 100%;
}
.tables {
  height: calc(100vh - 20px - 70px);
  margin-left: 20px;
  padding: 30px;
}

.table ::v-deep .el-table--fit {
  padding: 20px 20px 0 20px;
}
.table ::v-deep th {
  background: transparent;
}
.table ::v-deep td {
  border: none;
}
.table ::v-deep .is-leaf {
  border: none;
}

.table ::v-deep .el-table,
.el-table__expanded-cell {
  background-color: transparent;
}

.table ::v-deep .el-table tr {
  background-color: transparent !important;
}
.table .el-table--enable-row-transition .el-table__body td,
.el-table .cell {
  background-color: transparent;
}

.table ::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
  background-color: #052c58;
}
.table ::v-deep thead {
  color: #fff;
}
.table ::v-deep .el-table {
  color: #89aed7;
}
.table ::v-deep .el-table__body-wrapper::-webkit-scrollbar {
  height: 10px;
}
.table ::v-deep .el-scrollbar__wrap {
  overflow-x: hidden;
}
.tables ::v-deep .el-scrollbar__wrap {
  overflow-x: hidden;
}
.table ::v-deep .el-scrollbar__thumb {
  background-color: #89aeb7;
  border-radius: 3px;
}
.tables ::v-deep .el-scrollbar__thumb {
  background-color: #89aeb7;
  border-radius: 3px;
}
.table ::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
  background-color: #89aeb7;
  border-radius: 3px;
}
// .table ::v-deep .el-table__body-wrapper::-webkit-scrollbar-track {
//   background-color: red;
//   padding: 20px;
//   border-radius: 3px;
// }
.table ::v-deep .el-scrollbar__view .el-table{
  padding-bottom:6px;
}
.el-table::before {
  //去除底部白线
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0px;
}
</style>




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用 CSS 样式来为 el-table 添加滚动条,具体的实现方式如下: 1. 在 el-table 的外层包裹一个 div 容器,并设置该容器的高度和 overflow 属性为 auto。 2. 在 el-table 的样式中,设置表格的宽度为 100%。 3. 在 el-table 的样式中,设置表格的 tbody 的 display 属性为 block,并设置其高度为 100%。 4. 在 el-table 的样式中,设置表格的 tbody 的 overflow 属性为 auto。 5. 在 el-table 的样式中,设置表格的 tbody 的 white-space 属性为 nowrap,这样可以让表格的内容不换行。 6. 在 el-table 的样式中,设置表格的 tbody 的 table-layout 属性为 fixed,这样可以让表格的列宽度固定。 7. 最后,在 el-table 的样式中,设置表格的 th 和 td 的 padding 属性为 0,这样可以让表格的内容与边框之间没有间隔。 下面是一个示例代码: ``` <template> <div class="table-container"> <el-table :data="tableData" style="width: 100%"> <el-table-column prop="name" label="姓名"></el-table-column> <el-table-column prop="age" label="年龄"></el-table-column> <el-table-column prop="address" label="地址"></el-table-column> </el-table> </div> </template> <style> .table-container { height: 300px; overflow: auto; } .el-table__body-wrapper { display: block; height: 100%; overflow: auto; white-space: nowrap; table-layout: fixed; } .el-table__header-wrapper th, .el-table__body-wrapper td { padding: 0; } </style> ``` 希望这个回答能够帮助到你!

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值