<template>
  <div class="flex h-full w-full flex-col bg-white">
    <el-tabs :value="activeKey" @tab-click="changeRouter">
      <el-tab-pane v-for="v in secondaryRoutes" :key="v.path" :name="v.path">
        <template slot="label">
          <i
            v-if="v.meta.icon"
            :class="['mr-[5px]', 'primary', v.meta.icon]"
          ></i>
          <span class="tab-label">{{ v.meta.title }}</span>
        </template>
      </el-tab-pane>
    </el-tabs>
    <div class="flex-1 overflow-y-auto p-[15px]">
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  name: "TabMenuBar",
  data() {
    return {
      subMenus: [],
    };
  },
  computed: {
    ...mapGetters("user", ["secondaryRoutes"]),
    activeKey() {
      return this.$route.path;
    },
  },
  created() {},
  methods: {
    changeRouter(e) {
      this.$router.push(e.name);
    },
  },
};
</script>

<style lang="less" scoped></style>
