Commit 608fa904 by 胡悦

Merge branch 'zj_dev_v1.5.0' into 'develop'

Zj dev v1.5.0

See merge request !1
2 parents 2635e3a8 a97c9aa3
...@@ -155,6 +155,12 @@ export default { ...@@ -155,6 +155,12 @@ export default {
// 点击二级菜单标题 // 点击二级菜单标题
const cItemClick = (path, cItem, parentItem) => { const cItemClick = (path, cItem, parentItem) => {
console.log('menuList:',store.state.menu.menuList)
console.log('parentItem:',parentItem)
console.log('path:',path)
console.log('cItem:',cItem)
Common.setBreadCrumbs(path);
const cOrigin = cItem.origin; const cOrigin = cItem.origin;
const pOrigin = parentItem.origin; const pOrigin = parentItem.origin;
let showEmpty = false; let showEmpty = false;
......
...@@ -50,5 +50,53 @@ export const Common = { ...@@ -50,5 +50,53 @@ export const Common = {
(err) => { } (err) => { }
); );
},
// 动态设置面包屑
setBreadCrumbs(url) {
let list = store.state.menu.menuList;
let m = ''
if (!url) {
return false;
}
let o = list.find(k => {
let n = (k.children || []).find(j => j.origin.frontRoute == url);
if (n) {
m = n;
return k
}
})
let arr = []
// 一级菜单
if (o) {
arr.push({ name: o.label, path: o.origin.frontRoute })
}
// 二级菜单
if (m) {
arr.push({ name: m.label, path: m.origin.frontRoute })
}
// 控制菜单展开
list.map(k => {
console.log(k.label +'---'+ o.label)
if (k.label == o.label) {
k.showSubList = true
} else {
k.showSubList = false;
}
(k.children || []).map(j => {
if (j.origin.frontRoute == m.origin.frontRoute) {
j.subItemActive = true
} else {
j.subItemActive = false;
}
})
})
store.dispatch("menu/setBreadCrumb", arr);
store.commit('menu/SET_MENU_LIST', list)
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!