mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	perf: tag
This commit is contained in:
		
							parent
							
								
									a8a3e5b303
								
							
						
					
					
						commit
						02c3a88ed6
					
				@ -1,15 +1,17 @@
 | 
				
			|||||||
import {
 | 
					import {
 | 
				
			||||||
  Router,
 | 
					  Router,
 | 
				
			||||||
 | 
					  RouteMeta,
 | 
				
			||||||
  createRouter,
 | 
					  createRouter,
 | 
				
			||||||
  RouteComponent,
 | 
					  RouteComponent,
 | 
				
			||||||
 | 
					  RouteRecordName,
 | 
				
			||||||
  createWebHashHistory,
 | 
					  createWebHashHistory,
 | 
				
			||||||
  RouteRecordNormalized
 | 
					  RouteRecordNormalized
 | 
				
			||||||
} from "vue-router";
 | 
					} from "vue-router";
 | 
				
			||||||
import { RouteConfigs } from "/@/layout/types";
 | 
					 | 
				
			||||||
import { split, uniqBy } from "lodash-es";
 | 
					 | 
				
			||||||
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 { useTimeoutFn } from "@vueuse/core";
 | 
					import { useTimeoutFn } from "@vueuse/core";
 | 
				
			||||||
 | 
					import { RouteConfigs } from "/@/layout/types";
 | 
				
			||||||
import { storageSession, storageLocal } from "/@/utils/storage";
 | 
					import { storageSession, storageLocal } from "/@/utils/storage";
 | 
				
			||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
 | 
					import { usePermissionStoreHook } from "/@/store/modules/permission";
 | 
				
			||||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
 | 
					import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
 | 
				
			||||||
@ -25,6 +27,7 @@ import externalLink from "./modules/externalLink";
 | 
				
			|||||||
import remainingRouter from "./modules/remaining";
 | 
					import remainingRouter from "./modules/remaining";
 | 
				
			||||||
import flowChartRouter from "./modules/flowchart";
 | 
					import flowChartRouter from "./modules/flowchart";
 | 
				
			||||||
import componentsRouter from "./modules/components";
 | 
					import componentsRouter from "./modules/components";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 动态路由
 | 
					// 动态路由
 | 
				
			||||||
import { getAsyncRoutes } from "/@/api/routes";
 | 
					import { getAsyncRoutes } from "/@/api/routes";
 | 
				
			||||||
import { transformI18n } from "/@/plugins/i18n";
 | 
					import { transformI18n } from "/@/plugins/i18n";
 | 
				
			||||||
@ -234,16 +237,29 @@ router.beforeEach((to, _from, next) => {
 | 
				
			|||||||
      if (usePermissionStoreHook().wholeRoutes.length === 0)
 | 
					      if (usePermissionStoreHook().wholeRoutes.length === 0)
 | 
				
			||||||
        initRouter(name.username).then((router: Router) => {
 | 
					        initRouter(name.username).then((router: Router) => {
 | 
				
			||||||
          if (!useMultiTagsStoreHook().getMultiTagsCache) {
 | 
					          if (!useMultiTagsStoreHook().getMultiTagsCache) {
 | 
				
			||||||
 | 
					            const handTag = (
 | 
				
			||||||
 | 
					              path: string,
 | 
				
			||||||
 | 
					              parentPath: string,
 | 
				
			||||||
 | 
					              name: RouteRecordName,
 | 
				
			||||||
 | 
					              meta: RouteMeta
 | 
				
			||||||
 | 
					            ): void => {
 | 
				
			||||||
 | 
					              useMultiTagsStoreHook().handleTags("push", {
 | 
				
			||||||
 | 
					                path,
 | 
				
			||||||
 | 
					                parentPath,
 | 
				
			||||||
 | 
					                name,
 | 
				
			||||||
 | 
					                meta
 | 
				
			||||||
 | 
					              });
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					            const parentPath = to.matched[0]?.path;
 | 
				
			||||||
            if (to.meta?.realPath) {
 | 
					            if (to.meta?.realPath) {
 | 
				
			||||||
              to.meta.title = `No.${to.params?.id} - 详情信息`;
 | 
					              const { path, name, meta } = to.matched[0]?.children[0];
 | 
				
			||||||
 | 
					              handTag(path, parentPath, name, meta);
 | 
				
			||||||
 | 
					              return router.push(path);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					              const { path, name, meta } = to;
 | 
				
			||||||
 | 
					              handTag(path, parentPath, name, meta);
 | 
				
			||||||
 | 
					              return router.push(to.path);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            useMultiTagsStoreHook().handleTags("push", {
 | 
					 | 
				
			||||||
              path: to.path,
 | 
					 | 
				
			||||||
              parentPath: to.matched[0]?.path,
 | 
					 | 
				
			||||||
              name: to.name,
 | 
					 | 
				
			||||||
              meta: to.meta
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
            return router.push(to.path);
 | 
					 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          router.push(to.path);
 | 
					          router.push(to.path);
 | 
				
			||||||
          // 刷新页面更新标签栏与页面路由匹配
 | 
					          // 刷新页面更新标签栏与页面路由匹配
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,7 @@ function toDetail(index: number) {
 | 
				
			|||||||
    parentPath: route.matched[0].path,
 | 
					    parentPath: route.matched[0].path,
 | 
				
			||||||
    name: "tabDetail",
 | 
					    name: "tabDetail",
 | 
				
			||||||
    meta: {
 | 
					    meta: {
 | 
				
			||||||
      title: `No.${index} - 详情信息`,
 | 
					      title: { zh: `No.${index} - 详情信息`, en: `No.${index} - DetailInfo` },
 | 
				
			||||||
      showLink: false,
 | 
					      showLink: false,
 | 
				
			||||||
      i18n: false,
 | 
					      i18n: false,
 | 
				
			||||||
      dynamicLevel: 3,
 | 
					      dynamicLevel: 3,
 | 
				
			||||||
@ -46,5 +46,17 @@ function toDetail(index: number) {
 | 
				
			|||||||
.tabs-container {
 | 
					.tabs-container {
 | 
				
			||||||
  padding: 10px;
 | 
					  padding: 10px;
 | 
				
			||||||
  background: #fff;
 | 
					  background: #fff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ::v-deep(.el-collapse-item__header) {
 | 
				
			||||||
 | 
					    line-height: 20px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ::v-deep(.el-collapse-item__wrap) {
 | 
				
			||||||
 | 
					    border-bottom: none;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  button {
 | 
				
			||||||
 | 
					    margin: 10px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user