From ce67644eb5d8f156164907fd941ad8e3e7993831 Mon Sep 17 00:00:00 2001 From: Dong Xia Date: Fri, 3 Feb 2023 05:42:16 +0000 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90store=E7=99=BB=E5=87=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dong Xia --- src/store/modules/user.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index adf6db6..3e8a397 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -69,6 +69,20 @@ const user = { }) }) }, + logOut({ dispatch, commit }) { + return new Promise((resolve, reject) => { + commit('setToken', {}) + commit('setMenus', '') + sessionStorage.removeItem(MENU_KEY) + // 调用其他 action + dispatch('clearTabs', true) + loginOut({}).then(() => { + resolve() + }).catch(() => { + reject() + }) + }) + } }, getters: { -- Gitee