table 无限滚动列表

<div class="content">
      <el-table
        ref="scroll_table"
        height="150"
        solt="append"
        :data="tableData"
        @cell-mouse-enter="mouseEnter"
        @cell-mouse-leave="mouseLeave"
        class="table"
      >
        <el-table-column
          v-for="(item, index) in dataColumList"
          :key="index + 'i'"
          :label="item.label"
          :prop="item.prop"
          show-overflow-tooltip
          align="center"
        >
          <template slot-scope="scope">
            <div  class="box" :class="scope.row.serialNumber === 1 ? 'box-1' : scope.row.serialNumber === 2 ? 'box-2' : scope.row.serialNumber === 3 ? 'box-3' : 'box-4'"  v-if="item.prop === 'serialNumber'">{{scope.row.serialNumber}}</div>
            <div v-else>
              {{scope.row[item.prop]}}
              <span v-if="item.prop === 'excludeTaxOrderAmountCount'">万元</span>
              <span v-if="item.prop === 'subTotalNetWeightCount'">吨</span>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>

列表滚动方法

dataColumList: [
        { label: '', prop: 'serialNumber' },
        { label: '大区', prop: 'saleDistrict' },
        { label: '区域', prop: 'district' },
        { label: '下达金额', prop: 'excludeTaxOrderAmountCount' },
        { label: '下达重量', prop: 'subTotalNetWeightCount' }
      ],
autoPlay: true,
scrolltimer: null
 mounted() {
    this.initData()
  },
  beforeDestroy() {
    this.startMove(true)
  },
  methods: {
    handleChange() {
      this.initData()
    },
    initData() {
      const params = {
        statisticsType: this.statisticsType,
        oneOrgId: this.$store.getters.organizationInfo.oneOrganizationId
      }
      this.axios(params).then(({ data }) => {
        this.tableData = data
        this.startMove()
      })
    },
    mouseEnter() {
      this.autoPlay = false
    },
    mouseLeave() {
      this.autoPlay = true
    },
    startMove(stop) {
      const table = this.$refs.scroll_table
      const divData = table.$refs.bodyWrapper
      if (stop) {
        window.clearInterval(this.scrolltimer)
      } else {
        this.scrolltimer = window.setInterval(() => {
          if (this.autoPlay) {
            divData.scrollTop += 1
            if (divData.clientHeight + divData.scrollTop === divData.scrollHeight) {
              divData.scrollTop = 0
            }
          }
        }, 30) // 滚动速度
      }
    }
  }

样式

.table{
  width: 100%;
  color: #99B3C8;
  margin-top: 4px;
}
/deep/.el-table{
  background-color: transparent !important;
}
/deep/.el-table::before{
  display: none !important;
}
/deep/.el-table th{
  line-height: 20px;
  background:rgba(13,48,99,1);
  color: #99B3C8;
}
/deep/.el-table tr {
  background-color: transparent !important;
}
/deep/.el-table td{
  padding: 6px 0px !important;
  border-bottom: 1px solid transparent !important;
}
/deep/.el-table--scrollable-y .el-table__body-wrapper{
  overflow-y: auto;
  &::-webkit-scrollbar {
    width: 1px !important;
  } //支持滚动
}
/deep/.el-table th.is-leaf{
  border-bottom: 1px solid transparent !important;
}
/deep/.el-table--mini th{
  padding: 2px 0px !important;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值