Skip to content

Commit

Permalink
fix[TagsView]: fixed CachedView bug (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
梁敏华 committed Nov 18, 2019
1 parent 25dddbb commit 2ed61af
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/store/modules/tagsView.js
Expand Up @@ -15,20 +15,25 @@ 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)
}
}
}
},

DEL_VISITED_VIEW: (state, view) => {
for (const [i, v] of state.visitedViews.entries()) {
if (v.path === view.path) {
if (v.path === view.matched[view.matched.length - 1].name) {
state.visitedViews.splice(i, 1)
break
}
}
},
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 2ed61af

Please sign in to comment.