|
@@ -1,5 +1,10 @@
|
|
|
<template>
|
|
|
- <el-menu :router="true" :default-active="defaultActive" class="el-menu-vertical-demo">
|
|
|
+ <el-menu
|
|
|
+ :router="true"
|
|
|
+ :default-active="defaultActive"
|
|
|
+ class="el-menu-vertical-demo"
|
|
|
+ @select="handleSelect"
|
|
|
+ >
|
|
|
<template v-for="(item,index) in data">
|
|
|
<el-menu-item :index="'/'+role+'/'+item.code" v-if="item.subMenuList.length==0">
|
|
|
<!-- <i v-bind:class="icons[item.code]"></i> -->
|
|
@@ -42,9 +47,20 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
// console.log(this.$route,'this.$route');
|
|
|
+ let menupath = localStorage.getItem('menuPath')
|
|
|
this.defaultActive = this.$route.fullPath;
|
|
|
+ if(this.$route.fullPath != menupath ){
|
|
|
+ this.defaultActive = menupath
|
|
|
+ this.$router.push({path:menupath});
|
|
|
+ }else{
|
|
|
+ this.defaultActive = this.$route.fullPath
|
|
|
+ }
|
|
|
},
|
|
|
- methods: {}
|
|
|
+ methods: {
|
|
|
+ handleSelect(key, keyPath) {
|
|
|
+ localStorage.setItem('menuPath',key)
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|