RanKing.vue 1.42 KB
<template>
  <div class="ranking-container">
    <div class="title">品牌排名</div>
    <div class="ranking">
      <div class="brand flex" v-for="(item, index) in brandList" :key="index">
        <span class="brand-num">{{ index + 1 }}</span>
        <marquee class="marquee" :direction="directionTimer" :delay="delayTimer" :text="item" />
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'RanKing',
  props: {
    list: {
      type: Array,
      default: () => []
    }
  },
  watch: {
    list: {
      handler(newVal) {
        this.brandList = newVal
      }
    }
  },
  data() {
    return {
      delayTimer: 3000,
      directionTimer: 3000,
      brandList: this.list
    }
  }
}
</script>
<style lang="scss" scoped>
.ranking-container {
  margin-left: 0.6vw;
  box-sizing: border-box;
  height: 12.7vh;
  background: #262525;
  .title {
    width: 6.7vw;
    background: rgba(53, 53, 53, 0.6);
    font-size: 10px;
    color: #eb6001;
    font-weight: 400;
    text-align: center;
    line-height: 2.4vh;
  }
  .ranking {
    font-size: 10px;
    color: #ffffff;
    letter-spacing: 0;
    font-weight: 400;
    padding-left: 0.6vw;
    padding-top: 0.1vh;
    padding-bottom: 0.4vh;
    .brand {
      line-height: 1.9vh;
      .brand-num {
        color: #606266;
        margin-right: 0.6vw;
      }
      .marquee {
        width: calc(100% - 2.2vw);
        height: 1.9vh;
      }
    }
  }
}
</style>