<template>
  <div class="mynav">
    <el-menu
      class="el-menu-demo"
      mode="horizontal"
      :unique-opened="true"
      :router="true"
      @open="$emit('getOpenKey', key)"
      @close="handleClose"
      @select="$emit('getClickKey', key)"
    >
      <navItem :dataList="navList" :clickKey="clickKey"></navItem>
    </el-menu>
  </div>
</template>
<script>
import navItem from "@/components/navItem.vue";
export default {
  name: "Nav",
  props: {
    navList: {
      //导航列表
      type: Array,
      default: () => [],
    },
    openKey: {
      //当前状态为展开的导航key
      type: String,
      default: "",
    },
    clickKey: {
      //当前激活导航的key
      type: String,
      default: "",
    },
  },
  data() {
    return {};
  },
  components: {
    navItem,
  },
  methods: {
    handleClose(key, keyPath) {},
  },
};
</script>

<style scoped>
</style>
