diff --git a/src/components/ScrollPane/index.vue b/src/components/ScrollPane/index.vue index 8051494f..ee554116 100644 --- a/src/components/ScrollPane/index.vue +++ b/src/components/ScrollPane/index.vue @@ -3,69 +3,114 @@
+
+
+
+
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index eed8b694..1fccaf69 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -29,6 +29,25 @@ const tagsView = { break } } + }, + DEL_OTHER_VIEWS: (state, view) => { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews = [].concat(state.visitedViews.slice(i, i + 1)) + break + } + } + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews = [].concat(state.cachedViews.slice(index, i + 1)) + break + } + } + }, + DEL_ALL_VIEWS: (state) => { + state.visitedViews = [] + state.cachedViews = [] } }, actions: { @@ -40,6 +59,18 @@ const tagsView = { commit('DEL_VISITED_VIEWS', view) resolve([...state.visitedViews]) }) + }, + delOtherViews({ commit, state }, view) { + return new Promise((resolve) => { + commit('DEL_OTHER_VIEWS', view) + resolve([...state.visitedViews]) + }) + }, + delAllViews({ commit, state }) { + return new Promise((resolve) => { + commit('DEL_ALL_VIEWS') + resolve([...state.visitedViews]) + }) } } } diff --git a/src/views/layout/components/TagsView.vue b/src/views/layout/components/TagsView.vue index 7e730280..88795649 100644 --- a/src/views/layout/components/TagsView.vue +++ b/src/views/layout/components/TagsView.vue @@ -1,18 +1,36 @@