mirror of
https://github.com/jekip/naive-ui-admin.git
synced 2026-02-04 13:42:27 +08:00
🐞 fix(tabs): fix redirect tag while refresh in header
This commit is contained in:
@@ -44,7 +44,7 @@
|
|||||||
<n-breadcrumb v-if="crumbsSetting.show">
|
<n-breadcrumb v-if="crumbsSetting.show">
|
||||||
<template
|
<template
|
||||||
v-for="routeItem in breadcrumbList"
|
v-for="routeItem in breadcrumbList"
|
||||||
:key="routeItem.name === 'Redirect' ? void 0 : routeItem.name"
|
:key="routeItem.name === RedirectName ? void 0 : routeItem.name"
|
||||||
>
|
>
|
||||||
<n-breadcrumb-item v-if="routeItem.meta.title">
|
<n-breadcrumb-item v-if="routeItem.meta.title">
|
||||||
<n-dropdown
|
<n-dropdown
|
||||||
@@ -129,17 +129,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, reactive, toRefs, ref, computed, unref } from 'vue';
|
|
||||||
import { useRouter, useRoute } from 'vue-router';
|
|
||||||
import components from './components';
|
|
||||||
import { NDialogProvider, useDialog, useMessage } from 'naive-ui';
|
|
||||||
import { TABS_ROUTES } from '@/store/mutation-types';
|
|
||||||
import { useUserStore } from '@/store/modules/user';
|
|
||||||
import { useScreenLockStore } from '@/store/modules/screenLock';
|
|
||||||
import ProjectSetting from './ProjectSetting.vue';
|
|
||||||
import { AsideMenu } from '@/layout/components/Menu';
|
|
||||||
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
|
||||||
import { websiteConfig } from '@/config/website.config';
|
import { websiteConfig } from '@/config/website.config';
|
||||||
|
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
||||||
|
import { AsideMenu } from '@/layout/components/Menu';
|
||||||
|
import { RedirectName } from '@/router/constant';
|
||||||
|
import { useScreenLockStore } from '@/store/modules/screenLock';
|
||||||
|
import { useUserStore } from '@/store/modules/user';
|
||||||
|
import { TABS_ROUTES } from '@/store/mutation-types';
|
||||||
|
import { NDialogProvider, useDialog, useMessage } from 'naive-ui';
|
||||||
|
import { computed, defineComponent, reactive, ref, toRefs, unref } from 'vue';
|
||||||
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import components from './components';
|
||||||
|
import ProjectSetting from './ProjectSetting.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'PageHeader',
|
name: 'PageHeader',
|
||||||
@@ -346,6 +347,7 @@
|
|||||||
mixMenu,
|
mixMenu,
|
||||||
websiteConfig,
|
websiteConfig,
|
||||||
handleMenuCollapsed,
|
handleMenuCollapsed,
|
||||||
|
RedirectName,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import type { RouteRecordRaw } from 'vue-router';
|
|
||||||
import { isNavigationFailure, Router } from 'vue-router';
|
|
||||||
import { useUser } from '@/store/modules/user';
|
|
||||||
import { useAsyncRoute } from '@/store/modules/asyncRoute';
|
|
||||||
import { ACCESS_TOKEN } from '@/store/mutation-types';
|
|
||||||
import { storage } from '@/utils/Storage';
|
|
||||||
import { PageEnum } from '@/enums/pageEnum';
|
import { PageEnum } from '@/enums/pageEnum';
|
||||||
import { ErrorPageRoute } from '@/router/base';
|
import { ErrorPageRoute } from '@/router/base';
|
||||||
|
import { useAsyncRoute } from '@/store/modules/asyncRoute';
|
||||||
|
import { useUser } from '@/store/modules/user';
|
||||||
|
import { ACCESS_TOKEN } from '@/store/mutation-types';
|
||||||
|
import { storage } from '@/utils/Storage';
|
||||||
|
import type { RouteRecordRaw } from 'vue-router';
|
||||||
|
import { isNavigationFailure, Router } from 'vue-router';
|
||||||
|
import { RedirectName } from './constant';
|
||||||
|
|
||||||
const LOGIN_PATH = PageEnum.BASE_LOGIN;
|
const LOGIN_PATH = PageEnum.BASE_LOGIN;
|
||||||
|
|
||||||
@@ -91,7 +92,7 @@ export function createRouterGuards(router: Router) {
|
|||||||
if (currentComName && !keepAliveComponents.includes(currentComName) && to.meta?.keepAlive) {
|
if (currentComName && !keepAliveComponents.includes(currentComName) && to.meta?.keepAlive) {
|
||||||
// 需要缓存的组件
|
// 需要缓存的组件
|
||||||
keepAliveComponents.push(currentComName);
|
keepAliveComponents.push(currentComName);
|
||||||
} else if (!to.meta?.keepAlive || to.name == 'Redirect') {
|
} else if (!to.meta?.keepAlive || to.name == RedirectName) {
|
||||||
// 不需要缓存的组件
|
// 不需要缓存的组件
|
||||||
const index = asyncRouteStore.keepAliveComponents.findIndex((name) => name == currentComName);
|
const index = asyncRouteStore.keepAliveComponents.findIndex((name) => name == currentComName);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import { RedirectName } from '@/router/constant';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { RouteLocationNormalized } from 'vue-router';
|
import { RouteLocationNormalized } from 'vue-router';
|
||||||
|
|
||||||
// 不需要出现在标签页中的路由
|
// 不需要出现在标签页中的路由
|
||||||
const whiteList = ['Redirect', 'login'];
|
const whiteList = [RedirectName, `${RedirectName}Son`, 'login'];
|
||||||
|
|
||||||
export type RouteItem = Partial<RouteLocationNormalized> & {
|
export type RouteItem = Partial<RouteLocationNormalized> & {
|
||||||
fullPath: string;
|
fullPath: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user