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