130 lines
2.5 KiB
Plaintext
130 lines
2.5 KiB
Plaintext
<template>
|
|
<view class="topbar" :style="{ paddingTop: statusBarHeight + 'px' }">
|
|
<view class="topbar__inner">
|
|
<!-- Menu button -->
|
|
<view class="topbar__btn" @tap="onMenuClick">
|
|
<text class="topbar__menu-icon">☰</text>
|
|
</view>
|
|
|
|
<!-- Title -->
|
|
<view class="topbar__title-area">
|
|
<text class="topbar__title">{{ title }}</text>
|
|
</view>
|
|
|
|
<!-- Profile button -->
|
|
<view class="topbar__profile-btn" @tap="onProfileClick">
|
|
<text class="topbar__profile-text">我的</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup lang="uts">
|
|
const props = defineProps<{
|
|
title: string
|
|
}>()
|
|
|
|
const emit = defineEmits<{
|
|
'menu-click': []
|
|
'profile-click': []
|
|
}>()
|
|
|
|
// Try to get status bar height from system info
|
|
const statusBarHeight = ref(0)
|
|
|
|
// Get system info on mount
|
|
uni.getSystemInfo({
|
|
success: (res) => {
|
|
statusBarHeight.value = res.statusBarHeight ?? 24
|
|
},
|
|
fail: () => {
|
|
statusBarHeight.value = 24
|
|
},
|
|
})
|
|
|
|
function onMenuClick(): void {
|
|
emit('menu-click')
|
|
}
|
|
|
|
function onProfileClick(): void {
|
|
emit('profile-click')
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.topbar {
|
|
position: relative;
|
|
z-index: 100;
|
|
background: rgba(15, 15, 26, 0.85);
|
|
backdrop-filter: blur(20px);
|
|
-webkit-backdrop-filter: blur(20px);
|
|
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
|
}
|
|
|
|
.topbar__inner {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
height: 88rpx;
|
|
padding: 0 16rpx;
|
|
}
|
|
|
|
.topbar__btn {
|
|
width: 72rpx;
|
|
height: 72rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: 50%;
|
|
transition: background 0.2s ease;
|
|
}
|
|
|
|
.topbar__btn:active {
|
|
background: rgba(255, 255, 255, 0.08);
|
|
}
|
|
|
|
.topbar__menu-icon {
|
|
font-size: 38rpx;
|
|
color: rgba(255, 255, 255, 0.8);
|
|
font-weight: 300;
|
|
}
|
|
|
|
.topbar__profile-btn {
|
|
height: 60rpx;
|
|
padding: 0 20rpx;
|
|
border-radius: 30rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: rgba(255, 255, 255, 0.06);
|
|
transition: background 0.2s ease;
|
|
}
|
|
|
|
.topbar__profile-btn:active {
|
|
background: rgba(255, 255, 255, 0.12);
|
|
}
|
|
|
|
.topbar__profile-text {
|
|
font-size: 24rpx;
|
|
color: rgba(255, 255, 255, 0.7);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.topbar__title-area {
|
|
flex: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.topbar__title {
|
|
font-size: 32rpx;
|
|
font-weight: 600;
|
|
color: rgba(255, 255, 255, 0.9);
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
max-width: 400rpx;
|
|
}
|
|
</style>
|