Files
airz-uniapp/components/AppHeader.uvue
T
hujun b0ee4f9d7e refactor: 重构移动端页面布局与资源路径,优化打包配置
1. 新增layout.uts统一管理页面尺寸与安全区计算
2. 修正图片资源路径到static/mobile目录
3. 调整App.vue与AppIcon组件样式适配多端
4. 为微信小程序配置打包忽略规则减少包体积
5. 修复API请求错误抛出类型,完善类型定义
6. 补充README文档说明项目运行与维护规范
7. 优化多个页面的样式与生命周期逻辑
2026-09-15 16:16:55 +08:00

34 lines
1.4 KiB
Plaintext

<template>
<view class="header-wrap">
<view class="status-bar" :style="statusStyle(0)"></view>
<view class="app-header">
<view class="header-side" @click="handleBack"><AppIcon v-if="back" name="chevron-right" :size="34" class="back-icon" /></view>
<text class="header-title">{{ title }}</text>
<view class="header-side header-right"><slot></slot></view>
</view>
</view>
</template>
<script setup lang="uts">
import { usePageLayout } from '@/services/layout.uts'
const { statusStyle } = usePageLayout()
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 { }
.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; }
.header-title { font-size: 34rpx; font-weight: 700; color: #111d35; }
</style>