美化左边栏的折叠过度效果
This commit is contained in:
parent
afda9db3bd
commit
eac8c464fa
@ -123,23 +123,34 @@ provide('session', session);
|
|||||||
<style src="../src/assets/style.css"></style>
|
<style src="../src/assets/style.css"></style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* 侧边栏整体样式优化 */
|
/* 侧边栏整体样式优化 - 平滑过渡 */
|
||||||
.app-sidebar-sider {
|
.app-sidebar-sider {
|
||||||
background: #fafafa !important;
|
background: #fafafa !important;
|
||||||
border-right: 1px solid rgba(0, 0, 0, 0.06) !important;
|
border-right: 1px solid rgba(0, 0, 0, 0.06) !important;
|
||||||
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
/* 使用平滑的缓动函数,避免抖动 */
|
||||||
|
box-shadow: 0 0 0 rgba(0, 0, 0, 0);
|
||||||
|
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 触发器样式优化 */
|
.app-sidebar-sider:not(.n-layout-sider--collapsed) {
|
||||||
|
box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 触发器样式优化 - 平滑过渡 */
|
||||||
.app-sidebar-sider .n-layout-sider-trigger {
|
.app-sidebar-sider .n-layout-sider-trigger {
|
||||||
background: #fff !important;
|
background: #fff !important;
|
||||||
border: 1px solid rgba(0, 0, 0, 0.08) !important;
|
border: 1px solid rgba(0, 0, 0, 0.08) !important;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
|
||||||
transition: all 0.2s ease !important;
|
/* 使用平滑的缓动函数,避免抖动 */
|
||||||
|
transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
||||||
width: 32px !important;
|
width: 32px !important;
|
||||||
height: 32px !important;
|
height: 32px !important;
|
||||||
border-radius: 50% !important;
|
border-radius: 50% !important;
|
||||||
right: -16px !important;
|
right: -16px !important;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
-webkit-backdrop-filter: blur(10px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-sidebar-sider .n-layout-sider-trigger:hover {
|
.app-sidebar-sider .n-layout-sider-trigger:hover {
|
||||||
@ -147,14 +158,22 @@ provide('session', session);
|
|||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.app-sidebar-sider .n-layout-sider-trigger:active {
|
||||||
|
background: #eeeeee !important;
|
||||||
|
}
|
||||||
|
|
||||||
.app-sidebar-sider .n-layout-sider-trigger .n-base-icon {
|
.app-sidebar-sider .n-layout-sider-trigger .n-base-icon {
|
||||||
color: #666;
|
color: #666;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
/* 移除旋转动画,避免抖动 */
|
||||||
|
transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 确保侧边栏内容正确显示 */
|
/* 确保侧边栏内容正确显示 */
|
||||||
.app-sidebar-sider .n-layout-sider-scroll-container {
|
.app-sidebar-sider .n-layout-sider-scroll-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
/* 添加内容过渡效果 */
|
||||||
|
transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -278,18 +278,22 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* 侧边栏容器 */
|
/* 侧边栏容器 - 添加整体过渡 */
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
display: block;
|
display: block;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #fafafa;
|
background: #fafafa;
|
||||||
|
/* 添加整体淡入淡出效果 */
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 用户信息区域 */
|
/* 用户信息区域 - 分层动画 */
|
||||||
.sidebar-header {
|
.sidebar-header {
|
||||||
padding: 16px 12px;
|
padding: 16px 12px;
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
||||||
transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
/* 使用平滑的缓动函数,避免抖动 */
|
||||||
|
transition: padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-header-collapsed {
|
.sidebar-header-collapsed {
|
||||||
@ -303,13 +307,21 @@ export default {
|
|||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s ease;
|
/* 使用平滑的缓动函数,避免抖动 */
|
||||||
|
transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
padding 0.25s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
gap 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info:hover {
|
.user-info:hover {
|
||||||
background: rgba(0, 0, 0, 0.04);
|
background: rgba(0, 0, 0, 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-info:active {
|
||||||
|
background: rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
.user-info-collapsed {
|
.user-info-collapsed {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
@ -318,12 +330,14 @@ export default {
|
|||||||
|
|
||||||
.user-info-collapsed .logo-icon {
|
.user-info-collapsed .logo-icon {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
/* 保持原始大小,不缩放 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo-icon {
|
.logo-icon {
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
/* 移除 transform 过渡,避免抖动 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info-text {
|
.user-info-text {
|
||||||
@ -332,6 +346,20 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
/* 平滑的淡入淡出效果 */
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
max-width: 200px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 折叠状态下隐藏文字 */
|
||||||
|
.user-info-collapsed .user-info-text {
|
||||||
|
opacity: 0;
|
||||||
|
max-width: 0;
|
||||||
|
transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
max-width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-name {
|
.brand-name {
|
||||||
@ -339,6 +367,7 @@ export default {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #1a1a1a;
|
color: #1a1a1a;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-name {
|
.user-name {
|
||||||
@ -348,6 +377,7 @@ export default {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 菜单区域 */
|
/* 菜单区域 */
|
||||||
@ -357,9 +387,10 @@ export default {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
padding: 8px 0;
|
padding: 8px 0;
|
||||||
|
/* 移除淡入淡出效果,避免抖动 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 菜单项样式优化 */
|
/* 菜单项样式优化 - 移除动画,避免抖动 */
|
||||||
:deep(.app-sidebar-menu .n-menu-item) {
|
:deep(.app-sidebar-menu .n-menu-item) {
|
||||||
margin: 1px 8px;
|
margin: 1px 8px;
|
||||||
}
|
}
|
||||||
@ -368,7 +399,10 @@ export default {
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
/* 使用平滑的缓动函数,避免抖动 */
|
||||||
|
transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #4a5568;
|
color: #4a5568;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
@ -379,10 +413,15 @@ export default {
|
|||||||
background: rgba(0, 0, 0, 0.04);
|
background: rgba(0, 0, 0, 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.app-sidebar-menu .n-menu-item-content:active) {
|
||||||
|
background: rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
:deep(.app-sidebar-menu .n-menu-item-content.n-menu-item-content--selected) {
|
:deep(.app-sidebar-menu .n-menu-item-content.n-menu-item-content--selected) {
|
||||||
background: rgba(24, 160, 88, 0.1);
|
background: rgba(24, 160, 88, 0.1);
|
||||||
color: #18a058;
|
color: #18a058;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
/* 移除脉冲动画,避免抖动 */
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.app-sidebar-menu .n-menu-item-content.n-menu-item-content--selected::before) {
|
:deep(.app-sidebar-menu .n-menu-item-content.n-menu-item-content--selected::before) {
|
||||||
@ -397,9 +436,10 @@ export default {
|
|||||||
border-radius: 0 2px 2px 0;
|
border-radius: 0 2px 2px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 折叠状态下的菜单项 */
|
/* 折叠状态下的菜单项 - 平滑过渡 */
|
||||||
:deep(.app-sidebar-menu.n-menu--collapsed .n-menu-item) {
|
:deep(.app-sidebar-menu.n-menu--collapsed .n-menu-item) {
|
||||||
margin: 2px 8px;
|
margin: 2px 8px;
|
||||||
|
/* 移除动画,避免抖动 */
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.app-sidebar-menu.n-menu--collapsed .n-menu-item-content) {
|
:deep(.app-sidebar-menu.n-menu--collapsed .n-menu-item-content) {
|
||||||
@ -407,16 +447,24 @@ export default {
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
/* 平滑过渡,不缩放 */
|
||||||
|
transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.app-sidebar-menu.n-menu--collapsed .n-menu-item-content:hover) {
|
||||||
|
background: rgba(0, 0, 0, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.app-sidebar-menu.n-menu--collapsed .n-menu-item-content.n-menu-item-content--selected::before) {
|
:deep(.app-sidebar-menu.n-menu--collapsed .n-menu-item-content.n-menu-item-content--selected::before) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 图标样式优化 - 更轻量优雅 */
|
/* 图标样式优化 - 统一大小,平滑过渡 */
|
||||||
:deep(.app-sidebar-menu .n-icon) {
|
:deep(.app-sidebar-menu .n-icon) {
|
||||||
color: #8b8e95;
|
color: #8b8e95;
|
||||||
transition: color 0.2s ease;
|
/* 使用平滑的缓动函数,避免抖动 */
|
||||||
|
transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,20 +473,23 @@ export default {
|
|||||||
height: 18px;
|
height: 18px;
|
||||||
stroke-width: 1.2;
|
stroke-width: 1.2;
|
||||||
display: block;
|
display: block;
|
||||||
|
/* 平滑过渡,避免抖动 */
|
||||||
|
transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
|
height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 折叠状态下的图标 */
|
/* 折叠状态下的图标 - 保持相同大小 */
|
||||||
:deep(.app-sidebar-menu.n-menu--collapsed .n-icon) {
|
:deep(.app-sidebar-menu.n-menu--collapsed .n-icon) {
|
||||||
font-size: 20px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.app-sidebar-menu.n-menu--collapsed .n-icon svg) {
|
:deep(.app-sidebar-menu.n-menu--collapsed .n-icon svg) {
|
||||||
width: 20px;
|
width: 18px;
|
||||||
height: 20px;
|
height: 18px;
|
||||||
stroke-width: 1.2;
|
stroke-width: 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 选中和悬停状态的图标颜色 */
|
/* 选中和悬停状态的图标颜色 - 平滑过渡,不缩放 */
|
||||||
:deep(.app-sidebar-menu .n-menu-item-content.n-menu-item-content--selected .n-icon) {
|
:deep(.app-sidebar-menu .n-menu-item-content.n-menu-item-content--selected .n-icon) {
|
||||||
color: #18a058;
|
color: #18a058;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user