<template>
  <el-menu class="el-menu-demo" mode="horizontal" @select="handleSelect">
    <menu-item v-for="item in treeData" :key="item.path" :item="item"></menu-item>
  </el-menu>
</template>

<script>
import MenuItem from './MenuItem.vue'
export default {
  name: 'Menu',
  components: {
    MenuItem
  },
  props: {
    treeData: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    handleSelect(key) {
      this.$router.push(key)
    }
  }
}
</script>
<style lang="scss" scoped>
.el-menu-demo {
  display: flex;
}
</style>
