From de21045e69ea1a1f5232e3b3a62200f148cba93f Mon Sep 17 00:00:00 2001 From: monkeycf <2548772327@qq.com> Date: Thu, 3 Oct 2019 21:07:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E9=A1=B6=E9=83=A8?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=BC=93=E5=AD=98=E6=95=B0=E7=BB=84=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/tagsView.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index 3e2c1703..f94546ce 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -28,13 +28,8 @@ const mutations = { } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break - } - } + const index = state.cachedViews.indexOf(view.name) + index > -1 && state.cachedViews.splice(index, 1) }, DEL_OTHERS_VISITED_VIEWS: (state, view) => { @@ -43,13 +38,8 @@ const mutations = { }) }, DEL_OTHERS_CACHED_VIEWS: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews = state.cachedViews.slice(index, index + 1) - break - } - } + const index = state.cachedViews.indexOf(view.name) + index > -1 && (state.cachedViews = state.cachedViews.slice(index, index + 1)) }, DEL_ALL_VISITED_VIEWS: state => {