Commit 211b5562 by 张杰

对子系统增加设置面包屑的方法

1 parent 2635e3a8
......@@ -155,6 +155,12 @@ export default {
// 点击二级菜单标题
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 pOrigin = parentItem.origin;
let showEmpty = false;
......
......@@ -50,5 +50,34 @@ export const Common = {
(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 })
}
store.dispatch("menu/setBreadCrumb", arr);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!