Files
airz-uniapp/components/AppHeader.uvue
T

32 lines
1.3 KiB
Plaintext
Raw Normal View History

2026-09-10 10:57:40 +08:00
<template>
<view class="header-wrap">
<view class="status-bar"></view>
<view class="app-header">
<view class="header-side" @click="handleBack"><AppIcon v-if="back" name="chevron-right" :size="34" class="back-icon" /></view>
2026-09-10 10:57:40 +08:00
<text class="header-title">{{ title }}</text>
<view class="header-side header-right"><slot></slot></view>
</view>
</view>
</template>
<script setup lang="uts">
import AppIcon from '@/components/AppIcon.uvue'
const props = defineProps({ title: { type: String, default: '' }, back: { type: Boolean, default: true } })
const handleBack = () => {
if (!props.back) return
const pages = getCurrentPages()
if (pages.length > 1) uni.navigateBack({ delta: 1 })
else uni.reLaunch({ url: '/pages/home/home' })
}
</script>
<style>
.header-wrap { background-color: #ffffff; }
.status-bar { height: var(--status-bar-height); }
.app-header { height: 96rpx; padding: 0 24rpx; flex-direction: row; align-items: center; justify-content: space-between; border-bottom: 1rpx solid #edf1f7; }
.header-side { width: 100rpx; height: 96rpx; align-items: flex-start; justify-content: center; }
.header-right { align-items: flex-end; }
.back-icon { transform: rotate(180deg); margin-top: 0; }
2026-09-10 10:57:40 +08:00
.header-title { font-size: 34rpx; font-weight: 700; color: #111d35; }
</style>