Paquete de tabla de desplazamiento de pantalla grande (VueSeamlessScroll)

 VueSeamlessScroll debe ser instalado primero por npm, y la introducción se ha escrito a continuación. Simplemente modifique el título de la parte superior y el campo de datos de su tabla. Pase el valor de la lista a este componente de escucha. Se puede generar cuando se monitorea.

<template>
  <div class="table-box">
    <div class="t-head">
      <div class="th">标题1</div>
      <div class="th">标题2</div>
      <div class="th">标题3</div>
      <div class="th">标题4</div>
    </div>
    <div class="t-body">
      <VueSeamlessScroll :key="scrollKey" :vScaleY="'100%'" :data="data" :classOption="{ singleHeight: 39}" class="warp">
        <ul class="item">
          <li v-for="(item, index) in data" :key="index">
            <span class="td ell" :title="item.xx1">{
   
   { item.xx1 }}</span>
            <span class="td ell" :title="item.xx2">{
   
   { item.xx2 }}</span>
            <span class="td ell" :title="item.xx3">{
   
   { item.xx3 }}</span>
            <span class="td ell" :title="item.xx4">{
   
   {item.xx4}}</span>
            <!--                  <span class="td">-->
            <!--                    <span v-if="item.zhuangtai===0" style="color:#28FF97;">状态1</span>-->
            <!--                    <span v-if="item.zhuangtai===1" style="color:#FFAF31;">状态2</span>-->
            <!--                  </span>-->
          </li>
        </ul>
      </VueSeamlessScroll>
    </div>
  </div>
</template>

<script>
import VueSeamlessScroll from 'vue-seamless-scroll'
export default {
  name: 'ClosedLoop',
  components: {
    VueSeamlessScroll
  },
  props: {
    TableData: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      scrollKey: 1,
      data: [],
      compressWidth: false
    }
  },
  watch: {
    TableData() {
      this.data = this.TableData
      this.scrollKey++
    }
  },
  created() {
    this.data = this.TableData
  },
  mounted() {

  },
  methods: {

  }
}

</script>
<style lang='scss' scoped>
.table-box{
  padding: 0 15px;
  .t-head{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 5px;
    padding-top: 10px;
    .th{
      width: 25%;
      font-size: 11px;
      font-family: DOUYUFont;
      font-weight: 700;
      font-style: italic;
      color: #00E5ED;
      text-align: center;
      padding: 0 0;
    }
  }
  .t-body{
    height: calc(100% - 40px);
  }
  .warp{
    height: 100%;
    margin: 0 auto 0;
    overflow: hidden;
    ul {
      list-style: none;
      padding: 0;
      margin: 0 auto;
      li {
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 14px;
        cursor: pointer;
        height: 28px;
        background: transparent;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #ffffff;
        &:hover{
          //background-color: rgba(25, 101, 194, 0.74);
          .sanjiao{
            display: block;
          }
        }
      }
      li:nth-child(2n - 1){
        background: rgba(39, 104, 136, 0.3);
      }
      .td{
        display: block;
        width: 25%;
        padding: 0 8px;
        text-align: center;
      }
      .ell{
        white-space:nowrap;//不换行
        overflow: hidden;//超出隐藏
        text-overflow: ellipsis;//变成...
      }
    }

  }
}
</style>

Supongo que te gusta

Origin blog.csdn.net/Blue54/article/details/128231379
Recomendado
Clasificación