mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	fix: 修复动态路由重定向造成标签页出现重复内容
This commit is contained in:
		
							parent
							
								
									b6ae64a89b
								
							
						
					
					
						commit
						a4a691de3e
					
				@ -23,7 +23,7 @@ import {
 | 
			
		||||
  formatFlatteningRoutes
 | 
			
		||||
} from "./utils";
 | 
			
		||||
import { buildHierarchyTree } from "@/utils/tree";
 | 
			
		||||
import { isUrl, openLink, storageSession } from "@pureadmin/utils";
 | 
			
		||||
import { isUrl, openLink, storageSession, isAllEmpty } from "@pureadmin/utils";
 | 
			
		||||
 | 
			
		||||
import remainingRouter from "./modules/remaining";
 | 
			
		||||
 | 
			
		||||
@ -158,11 +158,22 @@ router.beforeEach((to: toRouteType, _from, next) => {
 | 
			
		||||
            getTopMenu(true);
 | 
			
		||||
            // query、params模式路由传参数的标签页不在此处处理
 | 
			
		||||
            if (route && route.meta?.title) {
 | 
			
		||||
              useMultiTagsStoreHook().handleTags("push", {
 | 
			
		||||
                path: route.path,
 | 
			
		||||
                name: route.name,
 | 
			
		||||
                meta: route.meta
 | 
			
		||||
              });
 | 
			
		||||
              if (isAllEmpty(route.parentId) && route.meta?.backstage) {
 | 
			
		||||
                // 此处为动态顶级路由(目录)
 | 
			
		||||
                const { path, name, meta } = route.children[0];
 | 
			
		||||
                useMultiTagsStoreHook().handleTags("push", {
 | 
			
		||||
                  path,
 | 
			
		||||
                  name,
 | 
			
		||||
                  meta
 | 
			
		||||
                });
 | 
			
		||||
              } else {
 | 
			
		||||
                const { path, name, meta } = route;
 | 
			
		||||
                useMultiTagsStoreHook().handleTags("push", {
 | 
			
		||||
                  path,
 | 
			
		||||
                  name,
 | 
			
		||||
                  meta
 | 
			
		||||
                });
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          router.push(to.fullPath);
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,7 @@ import { components } from "@/router/enums";
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  path: "/components",
 | 
			
		||||
  redirect: "/components/video",
 | 
			
		||||
  redirect: "/components/dialog",
 | 
			
		||||
  meta: {
 | 
			
		||||
    icon: "menu",
 | 
			
		||||
    title: $t("menus.hscomponents"),
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user