mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-06 08:27:54 +08:00
Compare commits
3 Commits
bb07b45dcc
...
4a87c24acd
Author | SHA1 | Date | |
---|---|---|---|
|
4a87c24acd | ||
|
1730ecf4ce | ||
|
21e5387ead |
@ -61,6 +61,21 @@ const getSubMenuIconStyle = computed((): CSSProperties => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const textClass = computed(() => {
|
||||||
|
const item = props.item;
|
||||||
|
const baseClass = "w-full! text-inherit!";
|
||||||
|
if (
|
||||||
|
layout.value !== "horizontal" &&
|
||||||
|
isCollapse.value &&
|
||||||
|
!toRaw(item.meta.icon) &&
|
||||||
|
((layout.value === "vertical" && item.parentId === null) ||
|
||||||
|
(layout.value === "mix" && item.parentId !== 0))
|
||||||
|
) {
|
||||||
|
return `${baseClass} min-w-[54px]! text-center! px-3!`;
|
||||||
|
}
|
||||||
|
return baseClass;
|
||||||
|
});
|
||||||
|
|
||||||
const expandCloseIcon = computed(() => {
|
const expandCloseIcon = computed(() => {
|
||||||
if (!getConfig()?.MenuArrowIconNoTransition) return "";
|
if (!getConfig()?.MenuArrowIconNoTransition) return "";
|
||||||
return {
|
return {
|
||||||
@ -144,7 +159,7 @@ function resolvePath(routePath) {
|
|||||||
item?.pathList?.length === 2)
|
item?.pathList?.length === 2)
|
||||||
"
|
"
|
||||||
truncated
|
truncated
|
||||||
class="w-full! pl-4! text-inherit!"
|
class="w-full! px-3! min-w-[54px]! text-center! text-inherit!"
|
||||||
>
|
>
|
||||||
{{ transformI18n(onlyOneChild.meta.title) }}
|
{{ transformI18n(onlyOneChild.meta.title) }}
|
||||||
</el-text>
|
</el-text>
|
||||||
@ -195,15 +210,7 @@ function resolvePath(routePath) {
|
|||||||
offset: [0, -10],
|
offset: [0, -10],
|
||||||
theme: tooltipEffect
|
theme: tooltipEffect
|
||||||
}"
|
}"
|
||||||
:class="{
|
:class="textClass"
|
||||||
'w-full!': true,
|
|
||||||
'text-inherit!': true,
|
|
||||||
'pl-4!':
|
|
||||||
layout !== 'horizontal' &&
|
|
||||||
isCollapse &&
|
|
||||||
!toRaw(item.meta.icon) &&
|
|
||||||
item.parentId === null
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
{{ transformI18n(item.meta.title) }}
|
{{ transformI18n(item.meta.title) }}
|
||||||
</ReText>
|
</ReText>
|
||||||
|
@ -7,7 +7,13 @@ import { buildHierarchyTree } from "@/utils/tree";
|
|||||||
import remainingRouter from "./modules/remaining";
|
import remainingRouter from "./modules/remaining";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import { isUrl, openLink, storageLocal, isAllEmpty } from "@pureadmin/utils";
|
import {
|
||||||
|
isUrl,
|
||||||
|
openLink,
|
||||||
|
storageLocal,
|
||||||
|
isAllEmpty,
|
||||||
|
cloneDeep
|
||||||
|
} from "@pureadmin/utils";
|
||||||
import {
|
import {
|
||||||
ascending,
|
ascending,
|
||||||
getTopMenu,
|
getTopMenu,
|
||||||
@ -55,6 +61,9 @@ export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
|||||||
formatFlatteningRoutes(buildHierarchyTree(ascending(routes.flat(Infinity))))
|
formatFlatteningRoutes(buildHierarchyTree(ascending(routes.flat(Infinity))))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** 初始的静态路由,用来在退出登陆时重置路由 */
|
||||||
|
const initConstantRoutes: Array<RouteRecordRaw> = cloneDeep(constantRoutes);
|
||||||
|
|
||||||
/** 用于渲染菜单,保持原始层级 */
|
/** 用于渲染菜单,保持原始层级 */
|
||||||
export const constantMenus: Array<RouteComponent> = ascending(
|
export const constantMenus: Array<RouteComponent> = ascending(
|
||||||
routes.flat(Infinity)
|
routes.flat(Infinity)
|
||||||
@ -87,17 +96,13 @@ export const router: Router = createRouter({
|
|||||||
|
|
||||||
/** 重置路由 */
|
/** 重置路由 */
|
||||||
export function resetRouter() {
|
export function resetRouter() {
|
||||||
router.getRoutes().forEach(route => {
|
router.clearRoutes();
|
||||||
const { name, meta } = route;
|
for (const route of initConstantRoutes.concat(...(remainingRouter as any))) {
|
||||||
if (name && router.hasRoute(name) && meta?.backstage) {
|
router.addRoute(route);
|
||||||
router.removeRoute(name);
|
}
|
||||||
router.options.routes = formatTwoStageRoutes(
|
router.options.routes = formatTwoStageRoutes(
|
||||||
formatFlatteningRoutes(
|
formatFlatteningRoutes(buildHierarchyTree(ascending(routes.flat(Infinity))))
|
||||||
buildHierarchyTree(ascending(routes.flat(Infinity)))
|
);
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
usePermissionStoreHook().clearAllCachePage();
|
usePermissionStoreHook().clearAllCachePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,6 +172,8 @@ function handleAsyncRoutes(routeList) {
|
|||||||
const flattenRouters: any = router
|
const flattenRouters: any = router
|
||||||
.getRoutes()
|
.getRoutes()
|
||||||
.find(n => n.path === "/");
|
.find(n => n.path === "/");
|
||||||
|
// 保持router.options.routes[0].children与path为"/"的children一致,防止数据不一致导致异常
|
||||||
|
flattenRouters.children = router.options.routes[0].children;
|
||||||
router.addRoute(flattenRouters);
|
router.addRoute(flattenRouters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -666,6 +666,10 @@ body[layout="horizontal"] {
|
|||||||
|
|
||||||
@include merge-style($sideBarWidth);
|
@include merge-style($sideBarWidth);
|
||||||
|
|
||||||
|
.el-menu {
|
||||||
|
--el-menu-hover-text-color: var(--pure-theme-menu-text) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.fixed-header,
|
.fixed-header,
|
||||||
.main-container {
|
.main-container {
|
||||||
transition: none !important;
|
transition: none !important;
|
||||||
@ -687,6 +691,7 @@ body[layout="mix"] {
|
|||||||
|
|
||||||
.el-menu {
|
.el-menu {
|
||||||
--el-menu-hover-bg-color: transparent !important;
|
--el-menu-hover-bg-color: transparent !important;
|
||||||
|
--el-menu-hover-text-color: var(--pure-theme-menu-text) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hideSidebar {
|
.hideSidebar {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user