MenuItem.vue 689 Bytes
<template>
  <app-link :to="resolvePath(item.path)" class="menu-item-wrapper">
    <el-menu-item :index="resolvePath(item.path)">
      <span>{{ item.name }}</span>
    </el-menu-item>
  </app-link>
</template>

<script>
import path from 'path'
import AppLink from './Link'

export default {
  name: 'MenuItem',
  components: { AppLink },
  props: {
    item: {
      type: Object,
      required: true
    },
    basePath: {
      type: String,
      default: ''
    }
  },
  methods: {
    resolvePath(routePath) {
      return path.resolve(this.basePath, routePath)
    }
  }
}
</script>

<style lang="scss" scoped>
.menu-item-wrapper {
  display: inline-block;
  height: 0;
}
</style>