DateTab.vue 1.08 KB
<template>
  <div class="date-tab-box">
    <div v-for="(item, index) in dateList" :key="index" class="tab-item" :class="tabActive == index ? 'tab-item-active' : ''" @click="changeDate(index)">{{ item }}</div>
  </div>
</template>

<script>
export default {
  name: 'DateTab',
  props: {
    dateList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      tabActive: 1,
      nearThreeMonth: '',
      nearSixMonth: '',
      nearOneYear: ''
    }
  },

  created() {},

  methods: {
    changeDate(val) {
      this.tabActive = val
      this.$emit('changeDate', val)
    }
  }
}
</script>

<style lang="scss" scoped>
.date-tab-box {
  display: flex;
  // width: 17.62vw;
  height: 3.56vh;
  border: 2px solid;
  border-image: linear-gradient(90deg, #074989, #30dcff, #074989) 1;
  padding: 0.28vh;
  box-sizing: border-box;
  .tab-item {
    font-weight: 400;
    font-size: 12px;
    color: #c9c9c9;
    height: 2.67vh;
    line-height: 2.67vh;
    padding: 0 0.83vw;
  }
  .tab-item-active {
    font-weight: 600;
    color: #ffffff;
    background: #244888;
  }
}
</style>