From 2cc14e5f5623dbd672100512f07097491bcf731d Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Wed, 18 Mar 2020 09:43:17 +0800
Subject: [PATCH] 若依 2.2
---
ruoyi-ui/src/store/modules/tagsView.js | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/ruoyi-ui/src/store/modules/tagsView.js b/ruoyi-ui/src/store/modules/tagsView.js
index e128d2a..476e555 100644
--- a/ruoyi-ui/src/store/modules/tagsView.js
+++ b/ruoyi-ui/src/store/modules/tagsView.js
@@ -28,13 +28,8 @@
}
},
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,12 +38,10 @@
})
},
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
- }
+ if (index > -1) {
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ } else {
+ state.cachedViews = []
}
},
--
Gitblit v1.9.2