Commit c2c32332 by vince

fix: shake when adding tabs

1 parent 9021e992
......@@ -22,8 +22,8 @@ const routes: RouteRecordRaw[] = [
title: $t('page.demos.access.frontendPermissions'),
},
name: 'Access',
path: '/access',
redirect: '/access/page-control',
path: 'access',
redirect: '/demos/access/page-control',
children: [
{
name: 'AccessPageControl',
......@@ -93,8 +93,8 @@ const routes: RouteRecordRaw[] = [
title: $t('page.demos.features.title'),
},
name: 'Features',
path: '/features',
redirect: '/features/hide-menu-children',
path: 'features',
redirect: '/demos/features/hide-menu-children',
children: [
{
name: 'HideChildrenInMenuParent',
......@@ -135,8 +135,8 @@ const routes: RouteRecordRaw[] = [
title: $t('page.demos.fallback.title'),
},
name: 'Fallback',
path: '/fallback',
redirect: '/fallback/403',
path: 'fallback',
redirect: '/demos/fallback/403',
children: [
{
name: 'Fallback403',
......@@ -183,8 +183,8 @@ const routes: RouteRecordRaw[] = [
title: $t('page.demos.outside.title'),
},
name: 'Outside',
path: '/outside',
redirect: '/outside/iframe',
path: 'outside',
redirect: '/demos/outside/iframe',
children: [
{
name: 'iframe',
......@@ -193,7 +193,7 @@ const routes: RouteRecordRaw[] = [
icon: 'mdi:newspaper-variant-outline',
title: $t('page.demos.outside.embedded'),
},
redirect: '/outside/iframe/vue-document',
redirect: '/demos/outside/iframe/vue-document',
children: [
{
name: 'VueDocument',
......@@ -226,7 +226,7 @@ const routes: RouteRecordRaw[] = [
icon: 'mdi:newspaper-variant-multiple-outline',
title: $t('page.demos.outside.externalLink'),
},
redirect: '/outside/external-link/vite',
redirect: '/demos/outside/external-link/vite',
children: [
{
name: 'Vite',
......@@ -258,8 +258,8 @@ const routes: RouteRecordRaw[] = [
title: $t('page.demos.nested.title'),
},
name: 'Nested',
path: '/nested',
redirect: '/nested/menu1',
path: 'nested',
redirect: '/demos/nested/menu1',
children: [
{
name: 'Menu1',
......@@ -279,7 +279,7 @@ const routes: RouteRecordRaw[] = [
keepAlive: true,
title: $t('page.demos.nested.menu2'),
},
redirect: '/nested/menu2/menu2-1',
redirect: '/demos/nested/menu2/menu2-1',
children: [
{
name: 'Menu21',
......@@ -300,7 +300,7 @@ const routes: RouteRecordRaw[] = [
icon: 'ic:round-menu',
title: $t('page.demos.nested.menu3'),
},
redirect: '/nested/menu3/menu3-1',
redirect: '/demos/nested/menu3/menu3-1',
children: [
{
name: 'Menu31',
......@@ -319,7 +319,7 @@ const routes: RouteRecordRaw[] = [
icon: 'ic:round-menu',
title: $t('page.demos.nested.menu3_2'),
},
redirect: '/nested/menu3/menu3-2/menu3-2-1',
redirect: '/demos/nested/menu3/menu3-2/menu3-2-1',
children: [
{
name: 'Menu321',
......
......@@ -33,8 +33,8 @@
"devDependencies": {
"@eslint/js": "^9.7.0",
"@types/eslint": "^8.56.10",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
......
......@@ -47,7 +47,7 @@
"tailwindcss": "^3.4.3"
},
"dependencies": {
"@iconify/json": "^2.2.227",
"@iconify/json": "^2.2.228",
"@iconify/tailwind": "^1.1.1",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/nesting": "0.0.0-insiders.565cd3e",
......@@ -58,7 +58,7 @@
"postcss-antd-fixes": "^0.2.0",
"postcss-import": "^16.1.0",
"postcss-preset-env": "^9.6.0",
"tailwindcss": "^3.4.4",
"tailwindcss": "^3.4.5",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
......
......@@ -20,6 +20,6 @@
],
"dependencies": {
"@vben/types": "workspace:*",
"vite": "^5.3.3"
"vite": "^5.3.4"
}
}
......@@ -46,7 +46,7 @@
"rollup": "^4.18.1",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.77.8",
"vite": "^5.3.3",
"vite": "^5.3.4",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-dts": "^3.9.1",
"vite-plugin-html": "^3.2.2"
......
......@@ -63,7 +63,7 @@ async function loadAndConvertEnv(
const compress = envConfig.VITE_COMPRESS || '';
const compressTypes = compress
.split(',')
.filter((item) => ['brotli', 'gzip'].includes(item));
.filter((item) => item === 'brotli' || item === 'gzip');
return {
appTitle: envConfig?.VITE_GLOB_APP_TITLE ?? 'Vben Admin',
compress: !!compress,
......
......@@ -73,8 +73,8 @@
"turbo": "^2.0.6",
"typescript": "^5.5.3",
"unbuild": "^2.0.0",
"vite": "^5.3.3",
"vitest": "^2.0.2",
"vite": "^5.3.4",
"vitest": "^2.0.3",
"vue-tsc": "^2.0.26"
},
"engines": {
......
......@@ -2,11 +2,9 @@
* @zh_CN 布局内容高度 css变量
* @en_US Layout content height
*/
const CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT = `--vben-content-height`;
export const CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT = `--vben-content-height`;
/**
* @zh_CN 默认命名空间
*/
const DEFAULT_NAMESPACE = 'vben';
export { CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT, DEFAULT_NAMESPACE };
export const DEFAULT_NAMESPACE = 'vben';
export * from './global';
export * from './globals';
export * from './vben';
......@@ -26,7 +26,7 @@ const style = computed((): CSSProperties => {
<template>
<section
:style="style"
class="border-border bg-background flex w-full border-b"
class="border-border bg-background flex w-full border-b transition-all duration-[100ms]"
>
<slot></slot>
</section>
......
......@@ -219,9 +219,12 @@ const maskVisible = computed(() => !sidebarCollapse.value && props.isMobile);
* header fixed值
*/
const headerFixed = computed(() => {
const { headerMode } = props;
return (
isMixedNav.value ||
['auto', 'auto-scroll', 'fixed'].includes(props.headerMode)
headerMode === 'fixed' ||
headerMode === 'auto-scroll' ||
headerMode === 'auto'
);
});
......@@ -230,7 +233,8 @@ const mainStyle = computed(() => {
let sidebarAndExtraWidth = 'unset';
if (
headerFixed.value &&
!['header-nav', 'mixed-nav'].includes(realLayout.value) &&
realLayout.value !== 'header-nav' &&
realLayout.value !== 'mixed-nav' &&
showSidebar.value &&
!props.isMobile
) {
......@@ -272,16 +276,9 @@ const tabbarStyle = computed((): CSSProperties => {
if (!isMixedNav.value) {
width = '100%';
} else if (sidebarEnable.value) {
const hoverWidth =
sidebarExpandOnHovering.value && !sidebarExpandOnHover.value
? props.sidebarWidth
: getSideCollapseWidth.value;
const runtimeWidth = isMixedNav.value ? hoverWidth : props.sidebarWidth;
marginLeft = sidebarCollapse.value
? getSideCollapseWidth.value
: runtimeWidth;
: props.sidebarWidth;
width = `calc(100% - ${getSidebarWidth.value}px)`;
} else {
......
......@@ -39,23 +39,6 @@ const style = computed(() => {
};
});
// const layout = () => {
// const { maxWidth, minWidth } = props;
// if (!contentRef.value) {
// return Math.max(maxWidth, minWidth);
// }
// // const contentWidth = contentRef.value.clientWidth - gap * 3;
// // let width = contentWidth / tabs.length;
// // width += gap * 2;
// // if (width > maxWidth) {
// // width = maxWidth;
// // }
// // if (width < minWidth) {
// // width = minWidth;
// // }
// tabWidth.value = maxWidth;
// };
const tabsView = computed((): TabConfig[] => {
return props.tabs.map((tab) => {
return {
......@@ -71,23 +54,10 @@ const tabsView = computed((): TabConfig[] => {
});
});
// watch(
// () => props.tabs,
// () => {
// nextTick(() => {
// layout();
// });
// },
// );
watch(active, () => {
scrollIntoView();
});
// onMounted(() => {
// layout();
// });
function handleClose(key: string) {
emit('close', key);
}
......@@ -114,9 +84,9 @@ function scrollIntoView() {
<div
ref="contentRef"
:class="contentClass"
class="relative !flex h-[calc(100%-1px)] w-max"
class="relative !flex h-[calc(100%-2px)] w-max"
>
<TransitionGroup name="slide-down">
<TransitionGroup name="slide-up">
<div
v-for="(tab, i) in tabsView"
:key="tab.key"
......
......@@ -85,7 +85,7 @@ function scrollIntoView() {
:class="contentClass"
class="relative !flex h-full w-max items-center"
>
<TransitionGroup name="slide-down">
<TransitionGroup name="slide-up">
<div
v-for="(tab, i) in tabsView"
:key="tab.key"
......
......@@ -107,11 +107,11 @@ const fallbackIcon = computed(() => {
});
const showBack = computed(() => {
return ['403', '404'].includes(props.status);
return props.status === '403' || props.status === '404';
});
const showRefresh = computed(() => {
return ['500', 'offline'].includes(props.status);
return props.status === '500' || props.status === 'offline';
});
const { push } = useRouter();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!