<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="代金券" :name="1"></el-tab-pane>
      <el-tab-pane label="代金券使用规则" :name="2"></el-tab-pane>
      <el-tab-pane label="领取记录" :name="3"></el-tab-pane>
    </el-tabs>
    <component :is="componentName"></component>
  </div>
</template>

<script>
import voucherList from "./components/list.vue";
import ruleConfig from "@/views/manage/voucher/index";
import recordList from "./components/record.vue";
export default {
  components: { voucherList, ruleConfig, recordList },
  data() {
    return {
      activeName: 1,
      componentName: voucherList,
    };
  },
  created() {},
  methods: {
    handleClick() {
      console.log(this.activeName);
      switch (this.activeName) {
        case 1:
          this.componentName = voucherList;
          break;
        case 2:
          this.componentName = ruleConfig;
          break;
        case 3:
          this.componentName = recordList;
          break;
      }
    },
  },
};
</script>
