|
|
@@ -4,8 +4,10 @@
|
|
|
</el-menu-item>
|
|
|
<el-submenu v-else :index="'' + menu.id">
|
|
|
<template slot="title">
|
|
|
- <i class="fa-fw" :class="menu.icon" v-if="menu.icon"></i>
|
|
|
- <span slot="title">{{ menu.name }}</span>
|
|
|
+ <div @click="goPath(menu.path, '' + menu.id, menu.children)">
|
|
|
+ <i class="fa-fw" :class="menu.icon" v-if="menu.icon"></i>
|
|
|
+ <span slot="title">{{ menu.name }}</span>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<sys-menu v-for="item in menu.children" :menu="item" :key="item.id"></sys-menu>
|
|
|
</el-submenu>
|
|
|
@@ -25,6 +27,15 @@ export default {
|
|
|
methods: {
|
|
|
click(e) {
|
|
|
console.log(e);
|
|
|
+ },
|
|
|
+ goPath(path, index, children) {
|
|
|
+ let child = children.find(item => {
|
|
|
+ return this.$route.path === item.path && this.$route;
|
|
|
+ });
|
|
|
+ if (path && this.$route && this.$route.path !== path && !child) {
|
|
|
+ this.$router.push(path);
|
|
|
+ this.$emit('open', index);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
computed: {
|