fix store chart style
This commit is contained in:
@@ -30,6 +30,11 @@ const pageBackground = computed(() => globalUIStore.bodyBackground);
|
||||
const pathCache = new Map<string, number>();
|
||||
|
||||
function calcDepth(sourceRoute: RouteLocationNormalized): number {
|
||||
const queryDepth = parseTransitionDepth(sourceRoute.query.transitionDepth);
|
||||
if (queryDepth !== undefined) {
|
||||
return queryDepth;
|
||||
}
|
||||
|
||||
if (!sourceRoute.meta.dynamicDepth) {
|
||||
return Number(sourceRoute.meta.depth ?? 0);
|
||||
}
|
||||
@@ -47,6 +52,22 @@ function calcDepth(sourceRoute: RouteLocationNormalized): number {
|
||||
return depth;
|
||||
}
|
||||
|
||||
function parseTransitionDepth(value: unknown): number | undefined {
|
||||
if (Array.isArray(value)) {
|
||||
return parseTransitionDepth(value[0]);
|
||||
}
|
||||
|
||||
if (typeof value !== "string") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const depth = Number(value);
|
||||
if (!Number.isInteger(depth) || depth < 0 || 20 < depth) {
|
||||
return undefined;
|
||||
}
|
||||
return depth;
|
||||
}
|
||||
|
||||
const unregisterGuard = router.beforeEach((to, from) => {
|
||||
const toDepth = calcDepth(to);
|
||||
const fromDepth = calcDepth(from);
|
||||
|
||||
Reference in New Issue
Block a user