mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	fix: update name
This commit is contained in:
		
							parent
							
								
									aca6a667f3
								
							
						
					
					
						commit
						8c31ca1bad
					
				@ -3,7 +3,7 @@
 | 
				
			|||||||
  "Title": "PureAdmin",
 | 
					  "Title": "PureAdmin",
 | 
				
			||||||
  "FixedHeader": true,
 | 
					  "FixedHeader": true,
 | 
				
			||||||
  "HiddenSideBar": false,
 | 
					  "HiddenSideBar": false,
 | 
				
			||||||
  "MultiTabsCache": false,
 | 
					  "MultiTagsCache": false,
 | 
				
			||||||
  "KeepAlive": true,
 | 
					  "KeepAlive": true,
 | 
				
			||||||
  "Locale": "zh",
 | 
					  "Locale": "zh",
 | 
				
			||||||
  "Layout": "vertical",
 | 
					  "Layout": "vertical",
 | 
				
			||||||
 | 
				
			|||||||
@ -41,7 +41,7 @@ import { handleAliveRoute, delAliveRoutes } from "/@/router";
 | 
				
			|||||||
import { useSettingStoreHook } from "/@/store/modules/settings";
 | 
					import { useSettingStoreHook } from "/@/store/modules/settings";
 | 
				
			||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
 | 
					import { usePermissionStoreHook } from "/@/store/modules/permission";
 | 
				
			||||||
import { toggleClass, removeClass, hasClass } from "/@/utils/operate";
 | 
					import { toggleClass, removeClass, hasClass } from "/@/utils/operate";
 | 
				
			||||||
import { RouteConfigs, relativeStorageType, tagsViewsType } from "../../types";
 | 
					import { RouteConfigs, multiTagsType, tagsViewsType } from "../../types";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const route = useRoute();
 | 
					const route = useRoute();
 | 
				
			||||||
const router = useRouter();
 | 
					const router = useRouter();
 | 
				
			||||||
@ -49,7 +49,7 @@ const translateX = ref<number>(0);
 | 
				
			|||||||
const activeIndex = ref<number>(-1);
 | 
					const activeIndex = ref<number>(-1);
 | 
				
			||||||
let refreshButton = "refresh-button";
 | 
					let refreshButton = "refresh-button";
 | 
				
			||||||
const instance = getCurrentInstance();
 | 
					const instance = getCurrentInstance();
 | 
				
			||||||
let relativeStorage: relativeStorageType;
 | 
					let multiTags: multiTagsType;
 | 
				
			||||||
const pureSetting = useSettingStoreHook();
 | 
					const pureSetting = useSettingStoreHook();
 | 
				
			||||||
const showTags = ref(storageLocal.getItem("tagsVal") || false);
 | 
					const showTags = ref(storageLocal.getItem("tagsVal") || false);
 | 
				
			||||||
const tabDom = templateRef<HTMLElement | null>("tabDom", null);
 | 
					const tabDom = templateRef<HTMLElement | null>("tabDom", null);
 | 
				
			||||||
@ -183,7 +183,7 @@ const tagsViews = ref<Array<tagsViewsType>>([
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
]);
 | 
					]);
 | 
				
			||||||
const dynamicTagList: ComputedRef<Array<RouteConfigs>> = computed(() => {
 | 
					const dynamicTagList: ComputedRef<Array<RouteConfigs>> = computed(() => {
 | 
				
			||||||
  return relativeStorage.routesInStorage;
 | 
					  return multiTags.routesInStorage;
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 显示模式,默认灵动模式显示
 | 
					// 显示模式,默认灵动模式显示
 | 
				
			||||||
@ -200,7 +200,7 @@ let buttonTop = ref(0);
 | 
				
			|||||||
let currentSelect = ref({});
 | 
					let currentSelect = ref({});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function dynamicRouteTag(value: string, parentPath: string): void {
 | 
					function dynamicRouteTag(value: string, parentPath: string): void {
 | 
				
			||||||
  const hasValue = relativeStorage.routesInStorage.some((item: any) => {
 | 
					  const hasValue = multiTags.routesInStorage.some((item: any) => {
 | 
				
			||||||
    return item.path === value;
 | 
					    return item.path === value;
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -215,7 +215,7 @@ function dynamicRouteTag(value: string, parentPath: string): void {
 | 
				
			|||||||
            meta: arrItem.meta,
 | 
					            meta: arrItem.meta,
 | 
				
			||||||
            name: arrItem.name
 | 
					            name: arrItem.name
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
          relativeStorage.routesInStorage = routerArrays;
 | 
					          multiTags.routesInStorage = routerArrays;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          if (arrItem.children && arrItem.children.length > 0) {
 | 
					          if (arrItem.children && arrItem.children.length > 0) {
 | 
				
			||||||
            concatPath(arrItem.children, value, parentPath);
 | 
					            concatPath(arrItem.children, value, parentPath);
 | 
				
			||||||
@ -248,7 +248,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const spliceRoute = (start?: number, end?: number, other?: boolean): void => {
 | 
					  const spliceRoute = (start?: number, end?: number, other?: boolean): void => {
 | 
				
			||||||
    if (other) {
 | 
					    if (other) {
 | 
				
			||||||
      relativeStorage.routesInStorage = [
 | 
					      multiTags.routesInStorage = [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          path: "/welcome",
 | 
					          path: "/welcome",
 | 
				
			||||||
          parentPath: "/",
 | 
					          parentPath: "/",
 | 
				
			||||||
@ -261,10 +261,10 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        obj
 | 
					        obj
 | 
				
			||||||
      ];
 | 
					      ];
 | 
				
			||||||
      routerArrays = relativeStorage.routesInStorage;
 | 
					      routerArrays = multiTags.routesInStorage;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      delAliveRouteList = routerArrays.splice(start, end);
 | 
					      delAliveRouteList = routerArrays.splice(start, end);
 | 
				
			||||||
      relativeStorage.routesInStorage = routerArrays;
 | 
					      multiTags.routesInStorage = routerArrays;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -366,7 +366,7 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
 | 
				
			|||||||
    case 5:
 | 
					    case 5:
 | 
				
			||||||
      // 关闭全部标签页
 | 
					      // 关闭全部标签页
 | 
				
			||||||
      routerArrays.splice(1, routerArrays.length);
 | 
					      routerArrays.splice(1, routerArrays.length);
 | 
				
			||||||
      relativeStorage.routesInStorage = routerArrays;
 | 
					      multiTags.routesInStorage = routerArrays;
 | 
				
			||||||
      usePermissionStoreHook().clearAllCachePage();
 | 
					      usePermissionStoreHook().clearAllCachePage();
 | 
				
			||||||
      router.push("/welcome");
 | 
					      router.push("/welcome");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -400,8 +400,8 @@ function disabledMenus(value: boolean) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是首页,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页
 | 
					// 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是首页,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页
 | 
				
			||||||
function showMenuModel(currentPath: string, refresh = false) {
 | 
					function showMenuModel(currentPath: string, refresh = false) {
 | 
				
			||||||
  let allRoute = unref(relativeStorage.routesInStorage);
 | 
					  let allRoute = unref(multiTags.routesInStorage);
 | 
				
			||||||
  let routeLength = unref(relativeStorage.routesInStorage).length;
 | 
					  let routeLength = unref(multiTags.routesInStorage).length;
 | 
				
			||||||
  // currentIndex为1时,左侧的菜单是首页,则不显示关闭左侧标签页
 | 
					  // currentIndex为1时,左侧的菜单是首页,则不显示关闭左侧标签页
 | 
				
			||||||
  let currentIndex = allRoute.findIndex(v => v.path === currentPath);
 | 
					  let currentIndex = allRoute.findIndex(v => v.path === currentPath);
 | 
				
			||||||
  // 如果currentIndex等于routeLength-1,右侧没有菜单,则不显示关闭右侧标签页
 | 
					  // 如果currentIndex等于routeLength-1,右侧没有菜单,则不显示关闭右侧标签页
 | 
				
			||||||
@ -452,7 +452,7 @@ function openMenu(tag, e) {
 | 
				
			|||||||
    showMenuModel(tag.path);
 | 
					    showMenuModel(tag.path);
 | 
				
			||||||
  } else if (
 | 
					  } else if (
 | 
				
			||||||
    // eslint-disable-next-line no-dupe-else-if
 | 
					    // eslint-disable-next-line no-dupe-else-if
 | 
				
			||||||
    relativeStorage.routesInStorage.length === 2 &&
 | 
					    multiTags.routesInStorage.length === 2 &&
 | 
				
			||||||
    route.path !== tag.path
 | 
					    route.path !== tag.path
 | 
				
			||||||
  ) {
 | 
					  ) {
 | 
				
			||||||
    showMenus(true);
 | 
					    showMenus(true);
 | 
				
			||||||
@ -531,8 +531,8 @@ watch(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
onBeforeMount(() => {
 | 
					onBeforeMount(() => {
 | 
				
			||||||
  if (!instance) return;
 | 
					  if (!instance) return;
 | 
				
			||||||
  relativeStorage = instance.appContext.app.config.globalProperties.$storage;
 | 
					  multiTags = instance.appContext.app.config.globalProperties.$storage;
 | 
				
			||||||
  routerArrays = relativeStorage.routesInStorage ?? routerArrays;
 | 
					  routerArrays = multiTags.routesInStorage ?? routerArrays;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 根据当前路由初始化操作标签页的禁用状态
 | 
					  // 根据当前路由初始化操作标签页的禁用状态
 | 
				
			||||||
  showMenuModel(route.fullPath);
 | 
					  showMenuModel(route.fullPath);
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,7 @@ export type RouteConfigs = {
 | 
				
			|||||||
  name?: string;
 | 
					  name?: string;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type relativeStorageType = {
 | 
					export type multiTagsType = {
 | 
				
			||||||
  routesInStorage: Array<RouteConfigs>;
 | 
					  routesInStorage: Array<RouteConfigs>;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,20 +0,0 @@
 | 
				
			|||||||
import { defineStore } from "pinia";
 | 
					 | 
				
			||||||
import { store } from "/@/store";
 | 
					 | 
				
			||||||
import { getConfig } from "/@/config";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export const useMultiTabsStore = defineStore({
 | 
					 | 
				
			||||||
  id: "pure-multiTabs",
 | 
					 | 
				
			||||||
  state: () => ({
 | 
					 | 
				
			||||||
    multiTabsCache: getConfig().MultiTabsCache
 | 
					 | 
				
			||||||
  }),
 | 
					 | 
				
			||||||
  getters: {
 | 
					 | 
				
			||||||
    getMultiTabsCache() {
 | 
					 | 
				
			||||||
      return this.multiTabsCache;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  actions: {}
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export function useMultiTabsStoreHook() {
 | 
					 | 
				
			||||||
  return useMultiTabsStore(store);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										21
									
								
								src/store/modules/multiTags.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/store/modules/multiTags.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					import { defineStore } from "pinia";
 | 
				
			||||||
 | 
					import { store } from "/@/store";
 | 
				
			||||||
 | 
					import { getConfig } from "/@/config";
 | 
				
			||||||
 | 
					// import { multiTagsType } from "/@/layout/types";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const useMultiTagsStore = defineStore({
 | 
				
			||||||
 | 
					  id: "pure-multiTags",
 | 
				
			||||||
 | 
					  state: () => ({
 | 
				
			||||||
 | 
					    multiTagsCache: getConfig().MultiTagsCache
 | 
				
			||||||
 | 
					  }),
 | 
				
			||||||
 | 
					  getters: {
 | 
				
			||||||
 | 
					    getMultiTagsCache() {
 | 
				
			||||||
 | 
					      return this.multiTagsCache;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  actions: {}
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function useMultiTagsStoreHook() {
 | 
				
			||||||
 | 
					  return useMultiTagsStore(store);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										2
									
								
								types/global.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								types/global.d.ts
									
									
									
									
										vendored
									
									
								
							@ -87,7 +87,7 @@ declare global {
 | 
				
			|||||||
    Title?: string;
 | 
					    Title?: string;
 | 
				
			||||||
    FixedHeader?: boolean;
 | 
					    FixedHeader?: boolean;
 | 
				
			||||||
    HiddenSideBar?: boolean;
 | 
					    HiddenSideBar?: boolean;
 | 
				
			||||||
    MultiTabsCache?: boolean;
 | 
					    MultiTagsCache?: boolean;
 | 
				
			||||||
    KeepAlive?: boolean;
 | 
					    KeepAlive?: boolean;
 | 
				
			||||||
    Locale?: string;
 | 
					    Locale?: string;
 | 
				
			||||||
    Layout?: string;
 | 
					    Layout?: string;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user