|
@@ -1,24 +1,29 @@
|
|
|
const state = {
|
|
|
visitedViews: [],
|
|
|
- cachedViews: []
|
|
|
+ cachedViews: [],
|
|
|
+ menuDict: {}
|
|
|
}
|
|
|
|
|
|
const mutations = {
|
|
|
+ SELECT_MENU: (state,menu)=> {
|
|
|
+ state.menuDict[menu.url] = menu.title;
|
|
|
+ },
|
|
|
ADD_VISITED_VIEW: (state, view) => {
|
|
|
console.log("ADD_VISITED_VIEW");
|
|
|
console.log(view.path);
|
|
|
+ console.log(state.menuDict[view.path] );
|
|
|
|
|
|
if (state.visitedViews.some(v => v.path === view.path)) return
|
|
|
|
|
|
- var newView = Object.assign({}, view, {
|
|
|
- title: view.meta.title || 'no-name'
|
|
|
- });
|
|
|
+ // var newView = Object.assign({}, view, {
|
|
|
+ // title: state.menuDict[view.path] || view.meta.title || 'no-name'
|
|
|
+ // });
|
|
|
|
|
|
- console.log(newView);
|
|
|
+ // console.log(newView);
|
|
|
|
|
|
state.visitedViews.push({
|
|
|
path : view.path,
|
|
|
- title: view.meta.title || 'no-name',
|
|
|
+ title: state.menuDict[view.path] || view.meta.title || 'no-name',
|
|
|
meta: view.meta,
|
|
|
name: view.name,
|
|
|
fullPath: view.fullPath
|
|
@@ -84,6 +89,9 @@ const mutations = {
|
|
|
}
|
|
|
|
|
|
const actions = {
|
|
|
+ selectMenu({commit},menu) {
|
|
|
+ commit('SELECT_MENU', menu)
|
|
|
+ },
|
|
|
addView({ dispatch }, view) {
|
|
|
console.log("addView");
|
|
|
|
|
@@ -96,7 +104,6 @@ const actions = {
|
|
|
addCachedView({ commit }, view) {
|
|
|
commit('ADD_CACHED_VIEW', view)
|
|
|
},
|
|
|
-
|
|
|
delView({ dispatch, state }, view) {
|
|
|
return new Promise(resolve => {
|
|
|
dispatch('delVisitedView', view)
|