Commit ed3541a1 authored by 晓彤's avatar 晓彤

更新菜单栏显示

parents d7283d9a 188783e4
......@@ -32,7 +32,11 @@
<script>
import { mapGetters } from 'vuex'
import menu from './menu.json'
<<<<<<< HEAD
import { getUserDetail } from '@/api/getLogin/'
=======
import { getUserDetail } from '@/api/Login/'
>>>>>>> 188783e41eb96a84e9f795823cfef2abfb4f1a2b
export default {
name: 'Aside',
data() {
......@@ -41,15 +45,18 @@ export default {
defaultOpen: ['0'],
// 激活的菜单
activePath: '',
menuList: [],
newNav: []
menuList: []
}
},
methods: {
getNav() {
<<<<<<< HEAD
this.nav = menu.menu
=======
const tempNav = menu.menu
>>>>>>> 188783e41eb96a84e9f795823cfef2abfb4f1a2b
// 循环判断新列表里的是数据是否在旧列表里出现
this.nav.forEach((element) => {
tempNav.forEach((element) => {
var temp = {}
temp['id'] = element.id
temp['icon'] = element.icon
......@@ -66,12 +73,18 @@ export default {
temp['child'].push(children)
}
})
this.newNav.push(temp)
// 判断子菜单是否为空,为空不添加
if (temp.child.length > 0) {
this.nav.push(temp)
}
})
console.log('newNav', this.newNav)
this.$store.dispatch('header/setNavs', {
<<<<<<< HEAD
// nav: this.nav
nav: []
=======
nav: this.nav
>>>>>>> 188783e41eb96a84e9f795823cfef2abfb4f1a2b
})
},
......@@ -88,7 +101,11 @@ export default {
window.sessionStorage.setItem('activePath', activePath)
},
// 获取用户详细信息
<<<<<<< HEAD
async getUserDetail() {
=======
getUserDetail() {
>>>>>>> 188783e41eb96a84e9f795823cfef2abfb4f1a2b
getUserDetail().then((resp) => {
this.menuList = resp.data.data.menuList
this.getNav()
......@@ -107,7 +124,7 @@ export default {
created() {
this.activePath = window.sessionStorage.getItem('activePath')
this.getUserDetail()
this.getNav()
// this.getNav()
}
}
</script>
......
......@@ -24,7 +24,7 @@
<script>
import { getNamespaceList } from '@/api/getXyqbData/'
import { login } from '@/api/getLogin/'
import { login } from '@/api/Login/'
export default {
data() {
return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment