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 Nov 18, 2019
1 parent 25dddbb commit caaa3ae
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/store/modules/tagsView.js
Expand Up @@ -15,13 +15,18 @@ 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
}
Expand Down

0 comments on commit caaa3ae

Please sign in to comment.