Commit d7283d9a authored by 晓彤's avatar 晓彤

修改

parent 5f846a5c
......@@ -8,9 +8,7 @@ const state = {
activeIndex: 0
}
], // 存储点击左侧导航栏后的导航名,作为标题显示头
crumbs: [
'测试平台', '主页'
], // 存储面包屑
crumbs: ['测试平台', '主页'], // 存储面包屑
activeIndex: 0, // 当前活跃的标题下标
count: 0 // 下标增值变量
}
......@@ -62,6 +60,7 @@ const mutations = {
const actions = {
setNavs(context, nav) {
console.log('setNav----', nav)
context.commit('setNav', nav)
}
}
......
......@@ -32,7 +32,7 @@
<script>
import { mapGetters } from 'vuex'
import menu from './menu.json'
// import { getUserDetail } from '@/api/getLogin/'
import { getUserDetail } from '@/api/getLogin/'
export default {
name: 'Aside',
data() {
......@@ -48,7 +48,6 @@ export default {
methods: {
getNav() {
this.nav = menu.menu
console.log('444', this.nav)
// 循环判断新列表里的是数据是否在旧列表里出现
this.nav.forEach((element) => {
var temp = {}
......@@ -57,12 +56,8 @@ export default {
temp['title'] = element.title
temp['child'] = []
element.child.forEach((children) => {
console.log('children: ', children)
var flag = false
console.log(this.menuList)
this.menuList.forEach((menu) => {
console.log('menu: ', menu)
console.log('children.path', children.path)
if (menu === children.path) {
flag = true
}
......@@ -76,7 +71,7 @@ export default {
console.log('newNav', this.newNav)
this.$store.dispatch('header/setNavs', {
// nav: this.nav
nav: this.newNav
nav: []
})
},
......@@ -94,11 +89,10 @@ export default {
},
// 获取用户详细信息
async getUserDetail() {
// getUserDetail().then((resp) => {
// this.menuList = resp.data.data.menuList
// console.log('menuList----', this.menuList)
// })
// this.getNav()
getUserDetail().then((resp) => {
this.menuList = resp.data.data.menuList
this.getNav()
})
}
},
computed: {
......
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