Commit c2c32332 by vince

fix: shake when adding tabs

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