mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-07 00:47:19 +08:00
fix: update
This commit is contained in:
parent
b65b972353
commit
6d3a8c5a88
@ -17,6 +17,7 @@ import { debounce } from "/@/utils/debounce";
|
||||
import { themeColorsType } from "../../types";
|
||||
import { useAppStoreHook } from "/@/store/modules/app";
|
||||
import { storageLocal, storageSession } from "/@/utils/storage";
|
||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
||||
import { toggleTheme } from "@zougt/vite-plugin-theme-preprocessor/dist/browser-utils";
|
||||
|
||||
const router = useRouter();
|
||||
@ -135,6 +136,18 @@ function onReset() {
|
||||
storageSession.clear();
|
||||
toggleClass(false, "html-grey", document.querySelector("html"));
|
||||
toggleClass(false, "html-weakness", document.querySelector("html"));
|
||||
useMultiTagsStoreHook().handleTags("equal", [
|
||||
{
|
||||
path: "/welcome",
|
||||
parentPath: "/",
|
||||
meta: {
|
||||
title: "message.hshome",
|
||||
icon: "el-icon-s-home",
|
||||
i18n: true,
|
||||
showLink: true
|
||||
}
|
||||
}
|
||||
]);
|
||||
router.push("/login");
|
||||
}
|
||||
|
||||
|
@ -255,18 +255,6 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
||||
startIndex,
|
||||
length
|
||||
});
|
||||
useMultiTagsStoreHook().handleTags("equal", [
|
||||
{
|
||||
path: "/welcome",
|
||||
parentPath: "/",
|
||||
meta: {
|
||||
title: "message.hshome",
|
||||
icon: "el-icon-s-home",
|
||||
i18n: true,
|
||||
showLink: true
|
||||
}
|
||||
}
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -12,6 +12,7 @@ import NProgress from "/@/utils/progress";
|
||||
import { useTimeoutFn } from "@vueuse/core";
|
||||
import { storageSession, storageLocal } from "/@/utils/storage";
|
||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
||||
|
||||
// 静态路由
|
||||
import homeRouter from "./modules/home";
|
||||
@ -230,7 +231,9 @@ router.beforeEach((to, _from, next) => {
|
||||
// 刷新
|
||||
if (usePermissionStoreHook().wholeRoutes.length === 0)
|
||||
initRouter(name.username).then((router: Router) => {
|
||||
router.push(to.path);
|
||||
useMultiTagsStoreHook().getMultiTagsCache
|
||||
? router.push(to.path)
|
||||
: router.push("/");
|
||||
// 刷新页面更新标签栏与页面路由匹配
|
||||
const localRoutes = storageLocal.getItem("responsive-tags");
|
||||
const optionsRoutes = router.options?.routes;
|
||||
|
@ -2,23 +2,26 @@ import { defineStore } from "pinia";
|
||||
import { store } from "/@/store";
|
||||
import { getConfig } from "/@/config";
|
||||
import { positionType } from "./types";
|
||||
import { storageLocal } from "/@/utils/storage";
|
||||
|
||||
export const useMultiTagsStore = defineStore({
|
||||
id: "pure-multiTags",
|
||||
state: () => ({
|
||||
// 存储标签页信息(路由信息)
|
||||
multiTags: [
|
||||
{
|
||||
path: "/welcome",
|
||||
parentPath: "/",
|
||||
meta: {
|
||||
title: "message.hshome",
|
||||
icon: "el-icon-s-home",
|
||||
i18n: true,
|
||||
showLink: true
|
||||
}
|
||||
}
|
||||
],
|
||||
multiTags: getConfig().MultiTagsCache
|
||||
? storageLocal.getItem("responsive-tags")
|
||||
: [
|
||||
{
|
||||
path: "/welcome",
|
||||
parentPath: "/",
|
||||
meta: {
|
||||
title: "message.hshome",
|
||||
icon: "el-icon-s-home",
|
||||
i18n: true,
|
||||
showLink: true
|
||||
}
|
||||
}
|
||||
],
|
||||
multiTagsCache: getConfig().MultiTagsCache
|
||||
}),
|
||||
getters: {
|
||||
@ -27,6 +30,10 @@ export const useMultiTagsStore = defineStore({
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
tagsCache(multiTags) {
|
||||
this.getMultiTagsCache &&
|
||||
storageLocal.setItem("responsive-tags", multiTags);
|
||||
},
|
||||
handleTags<T>(mode: string, value?: T, position?: positionType): any {
|
||||
switch (mode) {
|
||||
case "equal":
|
||||
@ -34,12 +41,15 @@ export const useMultiTagsStore = defineStore({
|
||||
break;
|
||||
case "push":
|
||||
this.multiTags.push(value);
|
||||
this.tagsCache(this.multiTags);
|
||||
break;
|
||||
case "splice":
|
||||
this.multiTags.splice(position?.startIndex, position?.length);
|
||||
this.tagsCache(this.multiTags);
|
||||
return this.multiTags;
|
||||
break;
|
||||
case "slice":
|
||||
this.multiTags.slice(-1);
|
||||
return this.multiTags.slice(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user