From 5487fceedce3f89144849df29ea44d407ea602be Mon Sep 17 00:00:00 2001 From: "lei.jiang" Date: Mon, 11 Dec 2017 14:44:18 +0800 Subject: [PATCH] =?UTF-8?q?1.tags=E8=BF=87=E5=A4=9A=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=BB=9A=E5=8A=A8=E6=9D=A1(=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E6=8C=89=E4=BD=8F=E6=BB=91=E5=8A=A8)=202.=E5=8F=B3?= =?UTF-8?q?=E9=94=AEtags=E6=98=BE=E7=A4=BA=E5=85=B3=E9=97=AD=E5=A4=9A?= =?UTF-8?q?=E4=B8=AAtag=E7=9A=84=E8=8F=9C=E5=8D=95=203.=E4=BC=98=E5=8C=96s?= =?UTF-8?q?crollPane=E6=BB=9A=E8=BD=AE=E6=BB=9A=E5=8A=A8=EF=BC=8C=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=81=8F=E7=A7=BB=E9=87=8F=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ScrollPane/index.vue | 145 +++++++++++++++-------- src/store/modules/tagsView.js | 31 +++++ src/views/layout/components/TagsView.vue | 139 ++++++++++++++++------ 3 files changed, 228 insertions(+), 87 deletions(-) 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 @@