MenuItem.vue
689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<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>