vue TabControl案例

<template>
  <div id="Furong">
    <div class="tab-control">
      <div v-for="(item, index) in titles" class="tab-control-item" :class="{active: isActive == index}"
        @click="onClick(index)">
        <span>{{item}}</span>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'Furong',
    data() {
      return {
        msg: 'hello furong!',
        titles: ['流行', '新款', '精选'],
        isActive: 0
      }
    },
    methods: {
      onClick(index) {
        console.log("onClick");
        this.isActive = index;
      }
    }
  }
</script>

<style>
  .tab-control {
    display: flex;
    background-color: orange;
  }

  .tab-control-item {
    flex: 1;
    height: 40px;
    line-height: 40px;
  }

  .active {
    color: orangered;
  }

  .tab-control-item>span {
    padding: 5px;
  }

  .active>span {
    border-bottom: 3px solid orangered;
  }
</style>

vue TabControl案例

上一篇:tabControl控件常用方法


下一篇:删除/编辑TabPages的TabControl填充