From f266713daf5ae75d3da792aea129d35905b763da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Tue, 8 Oct 2019 18:20:11 +0800 Subject: [PATCH] fix[tagsView]: fixed DEL_OTHERS_CACHED_VIEWS bug --- src/store/modules/tagsView.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index f94546c..57e7242 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -39,7 +39,12 @@ const mutations = { }, DEL_OTHERS_CACHED_VIEWS: (state, view) => { const index = state.cachedViews.indexOf(view.name) - index > -1 && (state.cachedViews = state.cachedViews.slice(index, index + 1)) + if (index > -1) { + state.cachedViews = state.cachedViews.slice(index, index + 1) + } else { + // if index = -1, there is no cached tags + state.cachedViews = [] + } }, DEL_ALL_VISITED_VIEWS: state => { -- GitLab