Skip to content

Commit

Permalink
fix: 修复在未开启标签页缓存时退出登录,可能存在标签页未重置的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxian521 committed Nov 21, 2022
1 parent c5b107e commit ad34c7b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/layout/hooks/useNav.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { computed } from "vue";
import { storeToRefs } from "pinia";
import { getConfig } from "@/config";
import { useRouter } from "vue-router";
import { emitter } from "@/utils/mitt";
Expand All @@ -10,12 +11,14 @@ import { useAppStoreHook } from "@/store/modules/app";
import { i18nChangeLanguage } from "@wangeditor/editor";
import { useUserStoreHook } from "@/store/modules/user";
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
import { usePermissionStoreHook } from "@/store/modules/permission";

const errorInfo = "当前路由配置不正确,请检查配置";

export function useNav() {
const pureApp = useAppStoreHook();
const routers = useRouter().options.routes;
const { wholeMenus } = storeToRefs(usePermissionStoreHook());

/** 用户名 */
const username = computed(() => {
Expand Down Expand Up @@ -99,6 +102,7 @@ export function useNav() {
}

function menuSelect(indexPath: string, routers): void {
if (wholeMenus.value.length === 0) return;
if (isRemaining(indexPath)) return;
let parentPath = "";
const parentPathIndex = indexPath.lastIndexOf("/");
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export const useUserStore = defineStore({
this.username = "";
this.roles = [];
removeToken();
router.push("/login");
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
resetRouter();
router.push("/login");
},
/** 刷新`token` */
async handRefreshToken(data) {
Expand Down

0 comments on commit ad34c7b

Please sign in to comment.