diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index 273d33bd..3e07ef04 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -6,14 +6,21 @@ const tagsView = { mutations: { ADD_VISITED_VIEWS: (state, view) => { if (state.visitedViews.some(v => v.path === view.path)) return - state.visitedViews.push({ - name: view.name, - path: view.path, - title: view.meta.title || 'no-name' - }) - if (!view.meta.noCache) { - state.cachedViews.push(view.name) + + if (view.showInVisitedViews) { + state.visitedViews.push({ + name: view.name, + path: view.path, + title: view.meta.title || 'no-name' + }) } + + if (!view.meta.noCache) { + const cachedViews = [...state.cachedViews] + cachedViews.push(view.name) + state.cachedViews = Array.from(new Set([...cachedViews])) + } + console.log(state.cachedViews) }, DEL_VISITED_VIEWS: (state, view) => { for (const [i, v] of state.visitedViews.entries()) { diff --git a/src/views/example/table/index.vue b/src/views/example/table/index.vue index de92c020..cdc33a02 100644 --- a/src/views/example/table/index.vue +++ b/src/views/example/table/index.vue @@ -8,7 +8,7 @@