From a3137fb6cbca592c285a93ce16aeb298cace233f 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 20:38:19 +0800 Subject: [PATCH] fix[logout]: empty tagsview when logout (#2632) --- src/store/modules/user.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index dbc29003..1391fa4a 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -73,13 +73,18 @@ const actions = { }, // user logout - logout({ commit, state }) { + logout({ commit, state, dispatch }) { return new Promise((resolve, reject) => { logout(state.token).then(() => { commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() resetRouter() + + // reset visited views and cached views + // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485 + dispatch('tagsView/delAllViews', null, { root: true }) + resolve() }).catch(error => { reject(error)