This commit is contained in:
dap
2024-08-10 13:36:03 +08:00
20 changed files with 267 additions and 218 deletions

View File

@@ -5,7 +5,7 @@ import type {
} from '@vben/types';
import {
cloneDepp,
cloneDeep,
generateMenus,
generateRoutesByBackend,
generateRoutesByFrontend,
@@ -18,7 +18,7 @@ async function generateAccessible(
) {
const { router } = options;
options.routes = cloneDepp(options.routes);
options.routes = cloneDeep(options.routes);
// 生成路由
const accessibleRoutes = await generateRoutes(mode, options);

View File

@@ -56,7 +56,9 @@ export function useAntdDesignTokens() {
tokens.colorBgBase = getCssVariableValue('--background');
tokens.borderRadius = getCssVariableValue('--radius', false);
const radius = Number.parseFloat(getCssVariableValue('--radius', false));
// 1rem = 16px
tokens.borderRadius = radius * 16;
tokens.colorBgLayout = getCssVariableValue('--background-deep');
tokens.colorBgMask = getCssVariableValue('--overlay');

View File

@@ -1,9 +1,6 @@
import type { TabDefinition } from '@vben/types';
import type { IContextMenuItem } from '@vben-core/tabs-ui';
import type {
RouteLocationNormalized,
RouteLocationNormalizedGeneric,
} from 'vue-router';
import type { RouteLocationNormalizedGeneric } from 'vue-router';
import { computed, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
@@ -103,7 +100,14 @@ export function useTabbar() {
watch(
() => route.path,
() => {
tabbarStore.addTab(route as RouteLocationNormalized);
// 这里不能用route用route时vue-router会自动将父级meta进行合并
const routes = router.getRoutes();
const currentRoute = routes.find((item) => item.path === route.path);
if (currentRoute) {
tabbarStore.addTab(
currentRoute as unknown as RouteLocationNormalizedGeneric,
);
}
},
{ immediate: true },
);