fix: update name

This commit is contained in:
xiaoxian521 2021-11-26 22:54:29 +08:00
parent aca6a667f3
commit 8c31ca1bad
6 changed files with 38 additions and 37 deletions

View File

@ -3,7 +3,7 @@
"Title": "PureAdmin",
"FixedHeader": true,
"HiddenSideBar": false,
"MultiTabsCache": false,
"MultiTagsCache": false,
"KeepAlive": true,
"Locale": "zh",
"Layout": "vertical",

View File

@ -41,7 +41,7 @@ import { handleAliveRoute, delAliveRoutes } from "/@/router";
import { useSettingStoreHook } from "/@/store/modules/settings";
import { usePermissionStoreHook } from "/@/store/modules/permission";
import { toggleClass, removeClass, hasClass } from "/@/utils/operate";
import { RouteConfigs, relativeStorageType, tagsViewsType } from "../../types";
import { RouteConfigs, multiTagsType, tagsViewsType } from "../../types";
const route = useRoute();
const router = useRouter();
@ -49,7 +49,7 @@ const translateX = ref<number>(0);
const activeIndex = ref<number>(-1);
let refreshButton = "refresh-button";
const instance = getCurrentInstance();
let relativeStorage: relativeStorageType;
let multiTags: multiTagsType;
const pureSetting = useSettingStoreHook();
const showTags = ref(storageLocal.getItem("tagsVal") || false);
const tabDom = templateRef<HTMLElement | null>("tabDom", null);
@ -183,7 +183,7 @@ const tagsViews = ref<Array<tagsViewsType>>([
}
]);
const dynamicTagList: ComputedRef<Array<RouteConfigs>> = computed(() => {
return relativeStorage.routesInStorage;
return multiTags.routesInStorage;
});
//
@ -200,7 +200,7 @@ let buttonTop = ref(0);
let currentSelect = ref({});
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;
});
@ -215,7 +215,7 @@ function dynamicRouteTag(value: string, parentPath: string): void {
meta: arrItem.meta,
name: arrItem.name
});
relativeStorage.routesInStorage = routerArrays;
multiTags.routesInStorage = routerArrays;
} else {
if (arrItem.children && arrItem.children.length > 0) {
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 => {
if (other) {
relativeStorage.routesInStorage = [
multiTags.routesInStorage = [
{
path: "/welcome",
parentPath: "/",
@ -261,10 +261,10 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
},
obj
];
routerArrays = relativeStorage.routesInStorage;
routerArrays = multiTags.routesInStorage;
} else {
delAliveRouteList = routerArrays.splice(start, end);
relativeStorage.routesInStorage = routerArrays;
multiTags.routesInStorage = routerArrays;
}
};
@ -366,7 +366,7 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
case 5:
//
routerArrays.splice(1, routerArrays.length);
relativeStorage.routesInStorage = routerArrays;
multiTags.routesInStorage = routerArrays;
usePermissionStoreHook().clearAllCachePage();
router.push("/welcome");
@ -400,8 +400,8 @@ function disabledMenus(value: boolean) {
//
function showMenuModel(currentPath: string, refresh = false) {
let allRoute = unref(relativeStorage.routesInStorage);
let routeLength = unref(relativeStorage.routesInStorage).length;
let allRoute = unref(multiTags.routesInStorage);
let routeLength = unref(multiTags.routesInStorage).length;
// currentIndex1
let currentIndex = allRoute.findIndex(v => v.path === currentPath);
// currentIndexrouteLength-1
@ -452,7 +452,7 @@ function openMenu(tag, e) {
showMenuModel(tag.path);
} else if (
// eslint-disable-next-line no-dupe-else-if
relativeStorage.routesInStorage.length === 2 &&
multiTags.routesInStorage.length === 2 &&
route.path !== tag.path
) {
showMenus(true);
@ -531,8 +531,8 @@ watch(
onBeforeMount(() => {
if (!instance) return;
relativeStorage = instance.appContext.app.config.globalProperties.$storage;
routerArrays = relativeStorage.routesInStorage ?? routerArrays;
multiTags = instance.appContext.app.config.globalProperties.$storage;
routerArrays = multiTags.routesInStorage ?? routerArrays;
//
showMenuModel(route.fullPath);

View File

@ -24,7 +24,7 @@ export type RouteConfigs = {
name?: string;
};
export type relativeStorageType = {
export type multiTagsType = {
routesInStorage: Array<RouteConfigs>;
};

View File

@ -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);
}

View 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
View File

@ -87,7 +87,7 @@ declare global {
Title?: string;
FixedHeader?: boolean;
HiddenSideBar?: boolean;
MultiTabsCache?: boolean;
MultiTagsCache?: boolean;
KeepAlive?: boolean;
Locale?: string;
Layout?: string;