|
|
@@ -47,18 +47,7 @@ const navs = {
|
|
|
},
|
|
|
actions: {},
|
|
|
mutations: {
|
|
|
- DEL_CACHED_VIEW: (state, action) => {
|
|
|
- const index = state.cachedViews.indexOf(action.label)
|
|
|
- if (index > -1) state.cachedViews.splice(index, 1)
|
|
|
- },
|
|
|
- DEL_ALL_CACHED_VIEWS: (state) => {
|
|
|
- state.cachedViews = [] // 清空所有缓存
|
|
|
- },
|
|
|
ADD_TAG: (state, action) => {
|
|
|
- if (!state.cachedViews.includes(action.label) && action.meta.keepAlive) {
|
|
|
- state.cachedViews.push(action.label)
|
|
|
- }
|
|
|
- console.log(state.cachedViews)
|
|
|
state.tag = action;
|
|
|
setStore({
|
|
|
name: 'tag',
|
|
|
@@ -71,10 +60,11 @@ const navs = {
|
|
|
name: 'tagList',
|
|
|
content: state.tagList
|
|
|
})
|
|
|
+ if (action.label != '首页' && !state.cachedViews.includes(action.label) && action.meta.keepAlive) {
|
|
|
+ state.cachedViews.push(action.label)
|
|
|
+ }
|
|
|
},
|
|
|
DEL_TAG: (state, action) => {
|
|
|
- const index = state.cachedViews.indexOf(action.label)
|
|
|
- if (index > -1) state.cachedViews.splice(index, 1)
|
|
|
state.tagList = state.tagList.filter(item => {
|
|
|
return !diff(item, action);
|
|
|
})
|
|
|
@@ -84,18 +74,19 @@ const navs = {
|
|
|
content: state.tagList
|
|
|
})
|
|
|
delTabsKey(state.tag.label)
|
|
|
+ state.cachedViews = state.cachedViews.filter(n => n !== action.label)
|
|
|
},
|
|
|
DEL_ALL_TAG: (state) => {
|
|
|
- state.cachedViews = []
|
|
|
state.tagList = [state.tagWel];
|
|
|
setStore({
|
|
|
name: 'tagList',
|
|
|
content: state.tagList
|
|
|
})
|
|
|
delAllTabsKey('ALL')
|
|
|
+ state.cachedViews = []
|
|
|
},
|
|
|
DEL_TAG_OTHER: (state) => {
|
|
|
- state.cachedViews = state.cachedViews.filter(item => item === state.tag.label)
|
|
|
+
|
|
|
state.tagList = state.tagList.filter(item => {
|
|
|
if (item.value === state.tag.value) {
|
|
|
return true;
|
|
|
@@ -109,6 +100,7 @@ const navs = {
|
|
|
content: state.tagList
|
|
|
})
|
|
|
delAllTabsKey(state.tag.label)
|
|
|
+ state.cachedViews = state.cachedViews.filter(item => item === state.tag.label)
|
|
|
},
|
|
|
SET_TAG_LIST(state, tagList) {
|
|
|
state.tagList = tagList;
|