功能:适配前端宽屏桌面布局

This commit is contained in:
xiaowang
2026-03-24 09:50:55 +08:00
parent 8043f13ea9
commit 5302af0c1a
13 changed files with 229 additions and 53 deletions
+57 -41
View File
@@ -31,47 +31,51 @@
</a-layout-sider>
<a-layout>
<a-layout-header class="header">
<div class="header-left">
<MenuUnfoldOutlined
v-if="collapsed"
class="trigger"
@click="toggleCollapsed"
/>
<MenuFoldOutlined
v-else
class="trigger"
@click="toggleCollapsed"
/>
</div>
<div class="header-right">
<a-dropdown>
<a class="user-dropdown" @click.prevent>
<a-avatar :size="32" :src="userInfo?.avatar || DEFAULT_AVATAR" />
<span class="username">{{ userInfo?.nickname || '管理员' }}</span>
<DownOutlined />
</a>
<template #overlay>
<a-menu>
<a-menu-item key="profile" @click="goToProfile">
<template #icon>
<UserOutlined />
</template>
个人中心
</a-menu-item>
<a-menu-divider />
<a-menu-item key="logout" @click="handleLogout">
<template #icon>
<LogoutOutlined />
</template>
退出登录
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
<div class="header-shell">
<div class="header-left">
<MenuUnfoldOutlined
v-if="collapsed"
class="trigger"
@click="toggleCollapsed"
/>
<MenuFoldOutlined
v-else
class="trigger"
@click="toggleCollapsed"
/>
</div>
<div class="header-right">
<a-dropdown>
<a class="user-dropdown" @click.prevent>
<a-avatar :size="32" :src="userInfo?.avatar || DEFAULT_AVATAR" />
<span class="username">{{ userInfo?.nickname || '管理员' }}</span>
<DownOutlined />
</a>
<template #overlay>
<a-menu>
<a-menu-item key="profile" @click="goToProfile">
<template #icon>
<UserOutlined />
</template>
个人中心
</a-menu-item>
<a-menu-divider />
<a-menu-item key="logout" @click="handleLogout">
<template #icon>
<LogoutOutlined />
</template>
退出登录
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</div>
</div>
</a-layout-header>
<a-layout-content class="content">
<router-view />
<div class="content-shell">
<router-view />
</div>
</a-layout-content>
</a-layout>
</a-layout>
@@ -288,15 +292,21 @@ onMounted(async () => {
.header {
background: white;
padding: 0 24px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
position: sticky;
top: 0;
z-index: 100;
}
.header-shell {
width: 100%;
max-width: var(--admin-content-max-width);
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.header-left {
display: flex;
align-items: center;
@@ -346,6 +356,12 @@ onMounted(async () => {
z-index: 1;
}
.content-shell {
width: 100%;
max-width: var(--admin-content-max-width);
margin: 0 auto;
}
.admin-layout :deep(.ant-layout-sider-collapsed) + .ant-layout .content {
margin-left: 80px;
}