Skip to content

Commit

Permalink
fix[TagsView]: fixed CachedView bug (PanJiaChen#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
梁敏华 committed Dec 12, 2019
1 parent 594fc58 commit d83b2ef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/store/modules/tagsView.js
Expand Up @@ -15,7 +15,12 @@ const mutations = {
ADD_CACHED_VIEW: (state, view) => {
if (state.cachedViews.includes(view.name)) return
if (!view.meta.noCache) {
state.cachedViews.push(view.name)
for (const matchedView of view.matched) {
const { name } = matchedView.components.default
if (name && state.cachedViews.indexOf(name) === -1) {
state.cachedViews.push(name)
}
}
}
},

Expand All @@ -28,7 +33,7 @@ const mutations = {
}
},
DEL_CACHED_VIEW: (state, view) => {
const index = state.cachedViews.indexOf(view.name)
const index = state.cachedViews.indexOf(view.matched[view.matched.length - 1].name)
index > -1 && state.cachedViews.splice(index, 1)
},

Expand Down

0 comments on commit d83b2ef

Please sign in to comment.