From 8365d9b1015c5b9e5c3a9740efddf45c3e94135d Mon Sep 17 00:00:00 2001 From: monkeycf <2548772327@qq.com> Date: Sun, 6 Oct 2019 11:33:33 +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=E6=A0=8F=E7=BC=93=E5=AD=98=E6=95=B0=E7=BB=84?= =?UTF-8?q?=EF=BC=8C=E5=88=A0=E9=99=A4=E5=85=83=E7=B4=A0=E5=87=BD=E6=95=B0?= 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 => {