You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
1.7 KiB
98 lines
1.7 KiB
|
3 weeks ago
|
<template>
|
||
|
|
<view>
|
||
|
|
<view class="cus-header" :style="{ marginTop: safeTop + 'px' }">
|
||
|
|
<text class="title">{{ title }}</text>
|
||
|
|
<view class="header-buttons">
|
||
|
|
<view class="back-btn" @click="handleBack" v-if="showBack">
|
||
|
|
<text class="back-icon">←</text>
|
||
|
|
</view>
|
||
|
|
<slot name="right"></slot>
|
||
|
|
</view>
|
||
|
|
</view>
|
||
|
|
<view :style="{ marginTop: safeTop + 'px', height: '40px' }"></view>
|
||
|
|
</view>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
export default {
|
||
|
|
props: {
|
||
|
|
title: {
|
||
|
|
type: String,
|
||
|
|
default: ''
|
||
|
|
},
|
||
|
|
showBack: {
|
||
|
|
type: Boolean,
|
||
|
|
default: true
|
||
|
|
}
|
||
|
|
},
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
safeTop: 30
|
||
|
|
};
|
||
|
|
},
|
||
|
|
mounted() {
|
||
|
|
const info = uni.getWindowInfo();
|
||
|
|
this.safeTop = Math.max(info.safeAreaInsets.top, 30);
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
handleBack() {
|
||
|
|
this.$emit('back');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
};
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style lang="scss" scoped>
|
||
|
|
.cus-header {
|
||
|
|
position: fixed;
|
||
|
|
top: 0;
|
||
|
|
left: 0;
|
||
|
|
right: 0;
|
||
|
|
display: flex;
|
||
|
|
flex-direction: column;
|
||
|
|
align-items: center;
|
||
|
|
z-index: 10;
|
||
|
|
}
|
||
|
|
|
||
|
|
.cus-header .title {
|
||
|
|
font-size: 52rpx;
|
||
|
|
font-weight: bold;
|
||
|
|
color: #fff;
|
||
|
|
margin-bottom: 16rpx;
|
||
|
|
text-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.2);
|
||
|
|
}
|
||
|
|
|
||
|
|
.header-buttons {
|
||
|
|
position: absolute;
|
||
|
|
top: 0;
|
||
|
|
left: 20rpx;
|
||
|
|
display: flex;
|
||
|
|
align-items: center;
|
||
|
|
gap: 20rpx;
|
||
|
|
}
|
||
|
|
|
||
|
|
.back-btn {
|
||
|
|
width: 80rpx;
|
||
|
|
height: 80rpx;
|
||
|
|
background: rgba(255, 255, 255, 0.2);
|
||
|
|
border-radius: 50%;
|
||
|
|
display: flex;
|
||
|
|
align-items: center;
|
||
|
|
justify-content: center;
|
||
|
|
backdrop-filter: blur(10rpx);
|
||
|
|
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.1);
|
||
|
|
transition: all 0.3s ease;
|
||
|
|
}
|
||
|
|
|
||
|
|
.back-btn:active {
|
||
|
|
transform: scale(0.9);
|
||
|
|
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
|
||
|
|
}
|
||
|
|
|
||
|
|
.back-icon {
|
||
|
|
font-size: 40rpx;
|
||
|
|
color: #fff;
|
||
|
|
font-weight: bold;
|
||
|
|
}
|
||
|
|
</style>
|