Commit c3883cec by 冒粤蓉

fix

1 parent 1fb7def1
No preview for this file type
......@@ -5,7 +5,7 @@
>
<el-breadcrumb>
<el-breadcrumb-item class="breadcrumb-item"
:class="{active: item.active, pointer: item.path}"
:class="{active: index === breadCrumbList.length - 1, pointer: item.path}"
v-for="(item, index) in breadCrumbList"
:key="index"
@click="routerGo(item, item.path || '/noData')">
......@@ -52,62 +52,14 @@ export default {
})
const breadCrumbList = computed(() => {
const curBreadCrumb = store.getters.curBreadCrumb,
curParent = curBreadCrumb['parent'],
curChildren = curBreadCrumb['children'];
let breadCrumbList = [];
if(curParent) {
breadCrumbList.push({
name: curChildren.menuName ? curParent.menuName : curParent.menuName
});
}
if(curChildren) {
const nextChildren = curChildren.children;
breadCrumbList.push({
name: nextChildren ? curChildren.menuName: curChildren.menuName,
path: curChildren.path,
active: nextChildren ? false : true
});
if(nextChildren) {
breadCrumbList.push({
name: nextChildren.menuName,
path: nextChildren.path,
active: nextChildren.active
});
}
}
return breadCrumbList;
return store.getters.curBreadCrumb;
})
const routerGo = (item, path) => {
let saveBreadCrumb = {};
const thisName = item.name.replace(' / ', '');
const curBreadCrumb = store.getters.curBreadCrumb,
curParent = curBreadCrumb['parent'],
curChildren = curBreadCrumb['children'];
if(thisName === curParent.menuName) {
saveBreadCrumb.parent = curParent;
saveBreadCrumb.children = {};
return false;
}
if(curChildren) {
const nextChildren = curChildren.children;
if(thisName === curChildren.menuName) {
saveBreadCrumb.parent = curParent;
if(nextChildren) {
delete curChildren.children;
}
saveBreadCrumb.children = curChildren;
} else {
if(thisName === nextChildren.menuName) {
saveBreadCrumb = curBreadCrumb;
}
}
}
store.dispatch('menu/setBreadCrumb', saveBreadCrumb);
history.pushState(null, path, path);
// store.dispatch('menu/setBreadCrumb', saveBreadCrumb);
// history.pushState(null, path, path);
}
return {
......
let state = {
is_collapse: false, // 折叠状态
menu: [], // 菜单数据
curBreadCrumb: {},
curBreadCrumb: [],
updateMenu: false
};
let init = false;
try {
const breadCrumbStorage = localStorage.getItem('breadCrumb');
const breadCrumbStorage = localStorage.getItem('breadcrumb');
if(breadCrumbStorage) {
state.curBreadCrumb = JSON.parse(breadCrumbStorage);
init = true;
}
} catch (error) {
......@@ -29,7 +30,15 @@ export default {
// 设置面包屑
SET_BREAD_CRUMB(state, data) {
state.curBreadCrumb = data;
localStorage.setItem('breadCrumb', JSON.stringify(data));
localStorage.setItem('breadcrumb', JSON.stringify(data));
},
ADD_BREAD_CRUMB(state, data) {
if(!init) {
let joinData = [...state.curBreadCrumb, ...data];
state.curBreadCrumb = joinData;
localStorage.setItem('breadcrumb', JSON.stringify(joinData));
}
init = false;
},
// 子系统操作更新菜单
UPDATE_MENU(state, data) {
......@@ -49,6 +58,9 @@ export default {
setBreadCrumb({ commit }, data) {
commit('SET_BREAD_CRUMB', data)
},
addBreadCrumb({ commit }, data) {
commit('ADD_BREAD_CRUMB', data)
},
// 子系统操作更新菜单
updateMenu({commit}, data) {
commit('UPDATE_MENU', data)
......
......@@ -32,7 +32,7 @@ module.exports = {
config
.plugin('html')
.tap(args => {
args[0].title= '虎哥e盾'
args[0].title= '试乘试驾管理平台'
return args
})
config.entry('main').add('babel-polyfill')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!