refactor(styles): 提取布局 mixin,派生主题色,消除硬编码与魔法数字

- 新增 _mixins.scss,统一 app-main / sidebar-scroll 高度计算
- _theme.scss 引入 SCSS 颜色令牌,menu-hover 改用 color-mix() 自动派生
- _variables.scss 新增 $sidebar-toggle-height 替代魔法数字 50px
- LeftLayout / TopLayout / MixLayout 中重复 calc 替换为 mixin 调用
- 修复 apifox / internal-doc demo 页面 tags-view 高度错误(34px→40px)
- 添加主题变量契约注释,方便后续新增主题
This commit is contained in:
Ray.Hao
2026-06-09 14:31:40 +08:00
parent 0a531ae955
commit fe3695d613
8 changed files with 126 additions and 25 deletions

View File

@@ -229,6 +229,8 @@ watch(
</script>
<style lang="scss" scoped>
@use "@/styles/base/mixins" as *;
.layout {
&__header {
position: sticky;
@@ -297,8 +299,8 @@ watch(
}
&__container {
@include app-main-height;
display: flex;
height: calc(100vh - $navbar-height);
padding-top: 0;
.layout__sidebar--left {
@@ -314,7 +316,7 @@ watch(
}
:deep(.el-scrollbar) {
height: calc(100vh - $navbar-height - 50px);
@include sidebar-scroll-height-with-toggle;
}
:deep(.el-menu) {
@@ -329,8 +331,8 @@ watch(
align-items: center;
justify-content: center;
width: 100%;
height: 50px;
line-height: 50px;
height: $sidebar-toggle-height;
line-height: $sidebar-toggle-height;
background-color: var(--menu-background);
box-shadow: 0 0 6px -2px var(--el-color-primary);
}
@@ -368,7 +370,7 @@ watch(
:deep(.hasTagsView) {
.app-main {
height: calc(100vh - $navbar-height - $tags-view-height) !important;
@include app-main-height-with-tags;
}
}
</style>