U:调整部分报错以及页面展示
This commit is contained in:
1 parent
6fe0569d44
commit
014e7c01fa
2 files changed
+20
-16
No files matched your search
@@ -2,7 +2,7 @@
|
|||||||
:root {
|
:root {
|
||||||
/* 布局尺寸变量 */
|
/* 布局尺寸变量 */
|
||||||
--header-height: 64px;
|
--header-height: 64px;
|
||||||
--sidebar-width: 290px;
|
--sidebar-width: 220px;
|
||||||
--sidebar-collapsed-width: 64px;
|
--sidebar-collapsed-width: 64px;
|
||||||
|
|
||||||
/* 间距变量 */
|
/* 间距变量 */
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
<n-icon size="32" class="logo-icon">
|
<n-icon size="32" class="logo-icon">
|
||||||
<img src="@/assets/logo.svg" alt="logo" />
|
<img src="@/assets/logo.svg" alt="logo" />
|
||||||
</n-icon>
|
</n-icon>
|
||||||
<!-- 使用 v-show 避免折叠时文字换行导致的跳动 -->
|
|
||||||
<span class="site-title" v-show="!collapsed">Argus</span>
|
<span class="site-title" v-show="!collapsed">Argus</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
@@ -36,14 +35,14 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<!-- 主体布局 (Flex Container) -->
|
<!-- 主体布局 (Flex Container) -->
|
||||||
<div class="app-body">
|
<!-- 改回 n-layout 以满足 n-layout-sider 的依赖,但强制使用 flex 布局 -->
|
||||||
|
<n-layout has-sider class="app-body">
|
||||||
<!-- 左侧导航栏 -->
|
<!-- 左侧导航栏 -->
|
||||||
<!-- 注意:这里保留 n-layout-sider 是为了利用它的折叠动画和样式 -->
|
|
||||||
<n-layout-sider
|
<n-layout-sider
|
||||||
bordered
|
bordered
|
||||||
collapse-mode="width"
|
collapse-mode="width"
|
||||||
:collapsed-width="64"
|
:collapsed-width="64"
|
||||||
:width="290"
|
:width="220"
|
||||||
:native-scrollbar="false"
|
:native-scrollbar="false"
|
||||||
class="app-sider"
|
class="app-sider"
|
||||||
v-model:collapsed="collapsed"
|
v-model:collapsed="collapsed"
|
||||||
@@ -67,14 +66,14 @@
|
|||||||
<router-view />
|
<router-view />
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</n-layout>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, watch, computed, h, onMounted } from 'vue'
|
import { ref, watch, computed, h, onMounted } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import { NMenu, NIcon, NLayoutSider, NInput } from 'naive-ui'
|
import { NMenu, NIcon, NLayout, NLayoutSider, NInput } from 'naive-ui'
|
||||||
import ThemeToggle from '@/components/ThemeToggle.vue'
|
import ThemeToggle from '@/components/ThemeToggle.vue'
|
||||||
import { useThemeStore } from '@/stores/theme'
|
import { useThemeStore } from '@/stores/theme'
|
||||||
import {
|
import {
|
||||||
@@ -227,8 +226,9 @@ const handleMenuSelect = (key: string) => {
|
|||||||
.header-left {
|
.header-left {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 200px; /* 固定宽度避免折叠时右侧内容跳动 */
|
width: 200px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo-icon {
|
.logo-icon {
|
||||||
@@ -265,28 +265,32 @@ const handleMenuSelect = (key: string) => {
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 关键布局区域 */
|
/* 强制覆盖 n-layout 的默认样式,确保 Flex 生效 */
|
||||||
.app-body {
|
:deep(.n-layout.app-body) {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex !important;
|
||||||
flex-direction: row;
|
flex-direction: row !important;
|
||||||
overflow: hidden; /* 防止body本身滚动 */
|
overflow: hidden; /* 防止body本身滚动 */
|
||||||
|
background-color: transparent; /* 透视背景 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 侧边栏 */
|
/* 侧边栏 */
|
||||||
.app-sider {
|
.app-sider {
|
||||||
height: 100%; /* 撑满 body 高度 */
|
height: 100%;
|
||||||
background-color: var(--sidebar-bg);
|
background-color: var(--sidebar-bg);
|
||||||
/* n-layout-sider 内部会自动处理 overflow */
|
/* 确保 sider 自身不收缩 */
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 内容区 */
|
/* 内容区 */
|
||||||
.app-content {
|
.app-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden; /* 内部滚动 */
|
overflow: hidden;
|
||||||
background-color: var(--content-bg);
|
background-color: var(--content-bg);
|
||||||
position: relative;
|
position: relative;
|
||||||
|
/* 确保内容区可以收缩 */
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-wrapper {
|
.content-wrapper {
|
||||||
@@ -307,4 +311,4 @@ const handleMenuSelect = (key: string) => {
|
|||||||
:deep(.n-layout-sider--collapsed .n-menu-item) {
|
:deep(.n-layout-sider--collapsed .n-menu-item) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in new issue
Block a user