mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-11-14 20:53:41 +08:00
Merge branch 'main' into example
This commit is contained in:
@@ -14,7 +14,7 @@ import FirstLevelMenu from '../components/first-level-menu.vue';
|
||||
import GlobalLogo from '../../global-logo/index.vue';
|
||||
|
||||
defineOptions({
|
||||
name: 'VerticalMenuMix'
|
||||
name: 'VerticalMixMenu'
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
@@ -166,11 +166,7 @@ init();
|
||||
<template>
|
||||
<DarkModeContainer class="size-full flex-y-center px-16px shadow-tab">
|
||||
<div ref="bsWrapper" class="h-full flex-1-hidden">
|
||||
<BetterScroll
|
||||
ref="bsScroll"
|
||||
:options="{ scrollX: true, scrollY: false, click: appStore.isMobile }"
|
||||
@click="removeFocus"
|
||||
>
|
||||
<BetterScroll ref="bsScroll" :options="{ scrollX: true, scrollY: false, click: true }" @click="removeFocus">
|
||||
<div
|
||||
ref="tabRef"
|
||||
class="h-full flex pr-18px"
|
||||
|
||||
@@ -19,7 +19,7 @@ export function filterAuthRoutesByRoles(routes: ElegantConstRoute[], roles: stri
|
||||
* @param route Auth route
|
||||
* @param roles Roles
|
||||
*/
|
||||
function filterAuthRouteByRoles(route: ElegantConstRoute, roles: string[]) {
|
||||
function filterAuthRouteByRoles(route: ElegantConstRoute, roles: string[]): ElegantConstRoute[] {
|
||||
const routeRoles = (route.meta && route.meta.roles) || [];
|
||||
|
||||
// if the route's "roles" is empty, then it is allowed to access
|
||||
@@ -34,6 +34,11 @@ function filterAuthRouteByRoles(route: ElegantConstRoute, roles: string[]) {
|
||||
filterRoute.children = filterRoute.children.flatMap(item => filterAuthRouteByRoles(item, roles));
|
||||
}
|
||||
|
||||
// Exclude the route if it has no children after filtering
|
||||
if (filterRoute.children?.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return hasPermission || isEmptyRoles ? [filterRoute] : [];
|
||||
}
|
||||
|
||||
@@ -283,8 +288,7 @@ export function getBreadcrumbsByRoute(
|
||||
|
||||
for (const menu of menus) {
|
||||
if (menu.key === key) {
|
||||
const breadcrumbMenu = menu;
|
||||
return [transformMenuToBreadcrumb(breadcrumbMenu)];
|
||||
return [transformMenuToBreadcrumb(menu)];
|
||||
}
|
||||
|
||||
if (menu.key === activeKey) {
|
||||
|
||||
@@ -11,7 +11,7 @@ export function createServiceConfig(env: Env.ImportMeta) {
|
||||
let other = {} as Record<App.Service.OtherBaseURLKey, string>;
|
||||
try {
|
||||
other = json5.parse(VITE_OTHER_SERVICE_BASE_URL);
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('VITE_OTHER_SERVICE_BASE_URL is not a valid json5 string');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user