|
|
@@ -69,21 +69,13 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
|
- this.data.forEach((item, index) => {
|
|
|
- if (item.children && item.children.length > 0) {
|
|
|
- item.children.forEach((sub, subPoint) => {
|
|
|
- if (this.currentPage.indexOf(sub.path) > -1) {
|
|
|
- this.subActive = subPoint
|
|
|
- this.active = index
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- const subIndex = this.currentPage.indexOf(item.path)
|
|
|
- if (subIndex > -1) {
|
|
|
- this.active = index
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ const item = localStorage.getItem('index')
|
|
|
+ if (item) {
|
|
|
+ console.log(JSON.parse(item))
|
|
|
+ const menu = JSON.parse(item)
|
|
|
+ this.active = menu.active
|
|
|
+ this.subActive = menu.subActive
|
|
|
+ }
|
|
|
},
|
|
|
menus() {
|
|
|
this.$api.common.getMenus().then(res => {
|
|
|
@@ -106,11 +98,15 @@ export default {
|
|
|
this.$router.push(item.path)
|
|
|
localStorage.setItem('data-type', item.remark ? item.remark : 'project')
|
|
|
}
|
|
|
+ const menu = { active: this.active, subActive: this.subActive }
|
|
|
+ localStorage.setItem('index', JSON.stringify(menu))
|
|
|
},
|
|
|
subClick(item, index) {
|
|
|
this.subActive = index
|
|
|
localStorage.setItem('data-type', item.remark ? item.remark : 'project')
|
|
|
this.$router.push(item.path)
|
|
|
+ const menu = { active: this.active, subActive: this.subActive }
|
|
|
+ localStorage.setItem('index', JSON.stringify(menu))
|
|
|
}
|
|
|
}
|
|
|
}
|