优化侧边栏样式
This commit is contained in:
parent
b247a8dcc6
commit
0b6cd8047e
@ -260,19 +260,15 @@ 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;
|
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !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;
|
||||||
/* 使用平滑的缓动函数,避免抖动 */
|
|
||||||
transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
||||||
width: 32px !important;
|
width: 32px !important;
|
||||||
height: 32px !important;
|
height: 32px !important;
|
||||||
@ -293,32 +289,26 @@ provide('session', session);
|
|||||||
.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;
|
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;
|
transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 确保 n-config-provider 占满高度 */
|
n-config-provider {
|
||||||
.n-config-provider {
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 确保侧边栏占满高度 */
|
|
||||||
.app-sidebar-sider {
|
.app-sidebar-sider {
|
||||||
height: 100% !important;
|
height: 100% !important;
|
||||||
min-height: 100vh !important;
|
min-height: 100vh !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 移动端遮罩层 */
|
|
||||||
.mobile-overlay {
|
.mobile-overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -330,7 +320,6 @@ provide('session', session);
|
|||||||
transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 移动端顶部导航栏 */
|
|
||||||
.mobile-header {
|
.mobile-header {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -401,7 +390,6 @@ provide('session', session);
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 移动端侧边栏样式优化 */
|
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
.app-sidebar-sider {
|
.app-sidebar-sider {
|
||||||
position: fixed !important;
|
position: fixed !important;
|
||||||
@ -419,13 +407,11 @@ provide('session', session);
|
|||||||
transform: translateX(0) !important;
|
transform: translateX(0) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 移动端主内容区域占满全宽 */
|
|
||||||
.n-layout {
|
.n-layout {
|
||||||
margin-left: 0 !important;
|
margin-left: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 桌面端保持原有样式 */
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 768px) {
|
||||||
.app-sidebar-sider {
|
.app-sidebar-sider {
|
||||||
position: relative !important;
|
position: relative !important;
|
||||||
|
|||||||
@ -243,23 +243,19 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* 侧边栏容器 - 添加整体过渡 */
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
background: #fafafa;
|
background: #fafafa;
|
||||||
/* 添加整体淡入淡出效果 */
|
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 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.25s cubic-bezier(0.4, 0, 0.2, 1);
|
transition: padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +270,6 @@ export default {
|
|||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
/* 使用平滑的缓动函数,避免抖动 */
|
|
||||||
transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
|
transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
padding 0.25s 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);
|
gap 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
@ -297,14 +292,12 @@ 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 {
|
||||||
@ -313,7 +306,6 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
/* 平滑的淡入淡出效果 */
|
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 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 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
@ -321,7 +313,6 @@ export default {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 折叠状态下隐藏文字 */
|
|
||||||
.user-info-collapsed .user-info-text {
|
.user-info-collapsed .user-info-text {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
max-width: 0;
|
max-width: 0;
|
||||||
@ -359,147 +350,18 @@ export default {
|
|||||||
color: #4a5568;
|
color: #4a5568;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 菜单区域 */
|
|
||||||
.sidebar-menu {
|
.sidebar-menu {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
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) {
|
|
||||||
margin: 1px 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.app-sidebar-menu .n-menu-item-content) {
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 10px 12px;
|
|
||||||
margin: 0;
|
|
||||||
/* 使用平滑的缓动函数,避免抖动 */
|
|
||||||
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;
|
|
||||||
color: #4a5568;
|
|
||||||
line-height: 1.5;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.app-sidebar-menu .n-menu-item-content:hover) {
|
|
||||||
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) {
|
|
||||||
background: rgba(24, 160, 88, 0.1);
|
|
||||||
color: #18a058;
|
|
||||||
font-weight: 500;
|
|
||||||
/* 移除脉冲动画,避免抖动 */
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.app-sidebar-menu .n-menu-item-content.n-menu-item-content--selected::before) {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
width: 3px;
|
|
||||||
height: 20px;
|
|
||||||
background: #18a058;
|
|
||||||
border-radius: 0 2px 2px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 折叠状态下的菜单项 - 平滑过渡 */
|
|
||||||
:deep(.app-sidebar-menu.n-menu--collapsed .n-menu-item) {
|
|
||||||
margin: 2px 8px;
|
|
||||||
/* 移除动画,避免抖动 */
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.app-sidebar-menu.n-menu--collapsed .n-menu-item-content) {
|
|
||||||
justify-content: center;
|
|
||||||
padding: 10px;
|
|
||||||
margin: 0;
|
|
||||||
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) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 图标样式优化 - 统一大小,平滑过渡 */
|
|
||||||
:deep(.app-sidebar-menu .n-icon) {
|
:deep(.app-sidebar-menu .n-icon) {
|
||||||
color: #8b8e95;
|
color: #8b8e95;
|
||||||
/* 使用平滑的缓动函数,避免抖动 */
|
|
||||||
transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.app-sidebar-menu .n-icon svg) {
|
|
||||||
width: 18px;
|
|
||||||
height: 18px;
|
|
||||||
stroke-width: 1.2;
|
|
||||||
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) {
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.app-sidebar-menu.n-menu--collapsed .n-icon svg) {
|
|
||||||
width: 18px;
|
|
||||||
height: 18px;
|
|
||||||
stroke-width: 1.2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 选中和悬停状态的图标颜色 - 平滑过渡,不缩放 */
|
|
||||||
:deep(.app-sidebar-menu .n-menu-item-content.n-menu-item-content--selected .n-icon) {
|
|
||||||
color: #18a058;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.app-sidebar-menu .n-menu-item-content:hover .n-icon) {
|
|
||||||
color: #18a058;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 菜单标签样式 */
|
|
||||||
:deep(.app-sidebar-menu .n-menu-item-content__icon) {
|
|
||||||
margin-right: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.app-sidebar-menu.n-menu--collapsed .n-menu-item-content__icon) {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 子菜单样式 */
|
|
||||||
:deep(.app-sidebar-menu .n-submenu) {
|
|
||||||
margin: 2px 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.app-sidebar-menu .n-submenu .n-submenu-children) {
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.app-sidebar-menu .n-submenu .n-menu-item-content) {
|
|
||||||
padding-left: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 滚动条样式 */
|
|
||||||
.sidebar-menu::-webkit-scrollbar {
|
.sidebar-menu::-webkit-scrollbar {
|
||||||
width: 4px;
|
width: 4px;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user