Просмотр исходного кода

fix: 退出登录后重刷当前页面清除路由信息

louhangfei 11 месяцев назад
Родитель
Сommit
cc4254ccbe
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      src/components/UserInfo.vue

+ 3 - 2
src/components/UserInfo.vue

@@ -23,9 +23,10 @@
   const userStore = useUserStore();
   const userStore = useUserStore();
   const emit = defineEmits(['switchAccount', 'modifyPassword']);
   const emit = defineEmits(['switchAccount', 'modifyPassword']);
 
 
-  const handleLogout = () => {
+  const handleLogout = async () => {
     userStore.logout();
     userStore.logout();
-    router.push({ path: '/home' });
+    await router.push({ path: '/home' });
+    window.location.reload();
   };
   };
 </script>
 </script>