110 lines
2.3 KiB
Vue
110 lines
2.3 KiB
Vue
<template>
|
|
<a-layout-header class="header">
|
|
<div class="header-left">
|
|
<menu-unfold-outlined v-if="collapsed" class="trigger" @click="toggleCollapsed" />
|
|
<menu-fold-outlined v-else class="trigger" @click="toggleCollapsed" />
|
|
<breadcrumb />
|
|
</div>
|
|
<div class="header-right">
|
|
<a-space>
|
|
<a-badge count="5">
|
|
<a-button type="text">
|
|
<template #icon>
|
|
<BellOutlined />
|
|
</template>
|
|
</a-button>
|
|
</a-badge>
|
|
<a-dropdown>
|
|
<a-button type="text">
|
|
<template #icon>
|
|
<UserOutlined />
|
|
</template>
|
|
Admin User
|
|
</a-button>
|
|
<template #overlay>
|
|
<a-menu>
|
|
<a-menu-item key="profile">
|
|
<user-outlined />
|
|
个人信息
|
|
</a-menu-item>
|
|
<a-menu-item key="settings">
|
|
<setting-outlined />
|
|
设置
|
|
</a-menu-item>
|
|
<a-menu-divider />
|
|
<a-menu-item key="logout" @click="handleLogout">
|
|
<logout-outlined />
|
|
退出登录
|
|
</a-menu-item>
|
|
</a-menu>
|
|
</template>
|
|
</a-dropdown>
|
|
</a-space>
|
|
</div>
|
|
</a-layout-header>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import {
|
|
BellOutlined,
|
|
LogoutOutlined,
|
|
MenuFoldOutlined,
|
|
MenuUnfoldOutlined,
|
|
SettingOutlined,
|
|
UserOutlined,
|
|
} from '@ant-design/icons-vue'
|
|
|
|
const props = defineProps<{ collapsed: boolean }>()
|
|
|
|
const emit = defineEmits(['update:collapsed', 'logout'])
|
|
|
|
function toggleCollapsed() {
|
|
emit('update:collapsed', !props.collapsed)
|
|
}
|
|
|
|
function handleLogout() {
|
|
emit('logout')
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.header {
|
|
padding: 0;
|
|
background: #fff;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
|
z-index: 10;
|
|
position: sticky;
|
|
top: 0;
|
|
width: 100%;
|
|
}
|
|
|
|
.header-left {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.header-right {
|
|
padding-right: 24px;
|
|
}
|
|
|
|
.trigger {
|
|
padding: 0 24px;
|
|
font-size: 18px;
|
|
cursor: pointer;
|
|
transition: color 0.3s;
|
|
}
|
|
|
|
.trigger:hover {
|
|
color: #1890ff;
|
|
}
|
|
|
|
.logo {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
color: rgba(0, 0, 0, 0.85);
|
|
}
|
|
</style>
|