<template>
  <div class="common-rule">
    <div class="mb-4 tab-btns">
      <el-button
        v-for="item in menus"
        :key="item.id"
        size="medium"
        :type="item.id == curMenu.id ? 'primary' : 'default'"
        @click="selectMenu(item)"
        >{{ item.name }}</el-button
      >
    </div>
    <component
      v-if="checkPrivilege('button', 'add')"
      :is="curMenu.component"
    ></component>
  </div>
</template>

<script>
import RuleExam from "../components/RuleExam";

export default {
  name: "common-rule",
  components: {
    RuleExam
  },
  data() {
    return {
      menus: [{ id: "1", name: "考务规则配置", component: "rule-exam" }],
      curMenu: {}
    };
  },
  created() {
    this.curMenu = this.menus[0];
  },
  methods: {
    selectMenu(item) {
      this.curMenu = item;
    }
  }
};
</script>
