mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	fix: router
This commit is contained in:
		
							parent
							
								
									a0c54a6ac9
								
							
						
					
					
						commit
						bae16008db
					
				@ -2,7 +2,7 @@ import { Router, RouteMeta, createRouter, RouteRecordName } from "vue-router";
 | 
				
			|||||||
import { toRouteType } from "./types";
 | 
					import { toRouteType } from "./types";
 | 
				
			||||||
import { openLink } from "/@/utils/link";
 | 
					import { openLink } from "/@/utils/link";
 | 
				
			||||||
import NProgress from "/@/utils/progress";
 | 
					import NProgress from "/@/utils/progress";
 | 
				
			||||||
import { split, uniqBy } from "lodash-es";
 | 
					import { split, uniqBy, find, findIndex } from "lodash-es";
 | 
				
			||||||
import { constantRoutes } from "./modules";
 | 
					import { constantRoutes } from "./modules";
 | 
				
			||||||
import { transformI18n } from "/@/plugins/i18n";
 | 
					import { transformI18n } from "/@/plugins/i18n";
 | 
				
			||||||
import remainingRouter from "./modules/remaining";
 | 
					import remainingRouter from "./modules/remaining";
 | 
				
			||||||
@ -102,7 +102,7 @@ router.beforeEach((to: toRouteType, _from, next) => {
 | 
				
			|||||||
              return router.push(refreshRedirect);
 | 
					              return router.push(refreshRedirect);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
              const { path } = to;
 | 
					              const { path } = to;
 | 
				
			||||||
              const index = remainingRouter.findIndex(v => {
 | 
					              const index = findIndex(remainingRouter, v => {
 | 
				
			||||||
                return v.path == path;
 | 
					                return v.path == path;
 | 
				
			||||||
              });
 | 
					              });
 | 
				
			||||||
              const routes =
 | 
					              const routes =
 | 
				
			||||||
@ -135,10 +135,13 @@ router.beforeEach((to: toRouteType, _from, next) => {
 | 
				
			|||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          router.push(to.path);
 | 
					          router.push(to.fullPath);
 | 
				
			||||||
          // 刷新页面更新标签栏与页面路由匹配
 | 
					          // 刷新页面更新标签栏与页面路由匹配
 | 
				
			||||||
          const localRoutes = storageLocal.getItem("responsive-tags");
 | 
					          const localRoutes = storageLocal.getItem("responsive-tags");
 | 
				
			||||||
          const optionsRoutes = router.options?.routes[0].children;
 | 
					          const home = find(router.options?.routes, function (route) {
 | 
				
			||||||
 | 
					            return route.path === "/";
 | 
				
			||||||
 | 
					          });
 | 
				
			||||||
 | 
					          const optionsRoutes = [home, ...router.options?.routes[0].children];
 | 
				
			||||||
          const newLocalRoutes = [];
 | 
					          const newLocalRoutes = [];
 | 
				
			||||||
          optionsRoutes.forEach(ors => {
 | 
					          optionsRoutes.forEach(ors => {
 | 
				
			||||||
            localRoutes.forEach(lrs => {
 | 
					            localRoutes.forEach(lrs => {
 | 
				
			||||||
 | 
				
			|||||||
@ -59,7 +59,7 @@ export const useMultiTagsStore = defineStore({
 | 
				
			|||||||
              return tag.path === tagVal?.path;
 | 
					              return tag.path === tagVal?.path;
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (tagHasExits) return;
 | 
					            if (tagHasExits && !tagVal.query) return;
 | 
				
			||||||
            const meta = tagVal?.meta;
 | 
					            const meta = tagVal?.meta;
 | 
				
			||||||
            const dynamicLevel = meta?.dynamicLevel ?? -1;
 | 
					            const dynamicLevel = meta?.dynamicLevel ?? -1;
 | 
				
			||||||
            if (dynamicLevel > 0) {
 | 
					            if (dynamicLevel > 0) {
 | 
				
			||||||
 | 
				
			|||||||
@ -25,6 +25,7 @@ export type multiType = {
 | 
				
			|||||||
  path: string;
 | 
					  path: string;
 | 
				
			||||||
  parentPath: string;
 | 
					  parentPath: string;
 | 
				
			||||||
  name: string;
 | 
					  name: string;
 | 
				
			||||||
 | 
					  query: object;
 | 
				
			||||||
  meta: any;
 | 
					  meta: any;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -12,6 +12,7 @@ function toDetail(index: number) {
 | 
				
			|||||||
    path: `/tabs/detail`,
 | 
					    path: `/tabs/detail`,
 | 
				
			||||||
    parentPath: route.matched[0].path,
 | 
					    parentPath: route.matched[0].path,
 | 
				
			||||||
    name: "tabDetail",
 | 
					    name: "tabDetail",
 | 
				
			||||||
 | 
					    query: { id: index },
 | 
				
			||||||
    meta: {
 | 
					    meta: {
 | 
				
			||||||
      title: { zh: `No.${index} - 详情信息`, en: `No.${index} - DetailInfo` },
 | 
					      title: { zh: `No.${index} - 详情信息`, en: `No.${index} - DetailInfo` },
 | 
				
			||||||
      showLink: false,
 | 
					      showLink: false,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user