Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into dev
This commit is contained in:
@@ -50,7 +50,15 @@ async function generateAccessible(
|
||||
delete route.component;
|
||||
}
|
||||
// 根据router name判断,如果路由已经存在,则不再添加
|
||||
if (!names?.includes(route.name)) {
|
||||
if (names?.includes(route.name)) {
|
||||
// 找到已存在的路由索引并更新,不更新会造成切换用户时,一级目录未更新,homePath 在二级目录导致的404问题
|
||||
const index = root.children?.findIndex(
|
||||
(item) => item.name === route.name,
|
||||
);
|
||||
if (index !== undefined && index !== -1 && root.children) {
|
||||
root.children[index] = route;
|
||||
}
|
||||
} else {
|
||||
root.children?.push(route);
|
||||
}
|
||||
} else {
|
||||
|
@@ -3,15 +3,17 @@ import type { StyleValue } from 'vue';
|
||||
|
||||
import type { PageProps } from './types';
|
||||
|
||||
import { computed, nextTick, onMounted, ref, useTemplateRef } from 'vue';
|
||||
|
||||
import { CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT } from '@vben-core/shared/constants';
|
||||
import { cn } from '@vben-core/shared/utils';
|
||||
import { computed, nextTick, onMounted, ref, useTemplateRef } from 'vue';
|
||||
|
||||
defineOptions({
|
||||
name: 'Page',
|
||||
});
|
||||
|
||||
const { autoContentHeight = false } = defineProps<PageProps>();
|
||||
const { autoContentHeight = false, heightOffset = 0 } =
|
||||
defineProps<PageProps>();
|
||||
|
||||
const headerHeight = ref(0);
|
||||
const footerHeight = ref(0);
|
||||
@@ -23,7 +25,7 @@ const footerRef = useTemplateRef<HTMLDivElement>('footerRef');
|
||||
const contentStyle = computed<StyleValue>(() => {
|
||||
if (autoContentHeight) {
|
||||
return {
|
||||
height: `calc(var(${CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT}) - ${headerHeight.value}px)`,
|
||||
height: `calc(var(${CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT}) - ${headerHeight.value}px - ${typeof heightOffset === 'number' ? `${heightOffset}px` : heightOffset})`,
|
||||
overflowY: shouldAutoHeight.value ? 'auto' : 'unset',
|
||||
};
|
||||
}
|
||||
|
@@ -8,4 +8,10 @@ export interface PageProps {
|
||||
autoContentHeight?: boolean;
|
||||
headerClass?: string;
|
||||
footerClass?: string;
|
||||
/**
|
||||
* Custom height offset value (in pixels) to adjust content area sizing
|
||||
* when used with autoContentHeight
|
||||
* @default 0
|
||||
*/
|
||||
heightOffset?: number;
|
||||
}
|
||||
|
Reference in New Issue
Block a user