Files
shoot-miniprograms/src/components/Header.vue

59 lines
1.0 KiB
Vue
Raw Normal View History

2025-05-01 21:38:35 +08:00
<script setup>
2025-06-15 22:01:06 +08:00
import { ref, onMounted } from "vue";
const isIos = ref(true);
2025-06-08 13:55:09 +08:00
2025-06-17 16:42:53 +08:00
const props = defineProps({
2025-05-01 21:38:35 +08:00
title: {
type: String,
default: "",
},
2025-06-17 16:42:53 +08:00
onBack: {
type: Function,
default: null,
},
2025-05-01 21:38:35 +08:00
});
2025-06-08 13:55:09 +08:00
2025-06-17 16:42:53 +08:00
const onClick = () => {
if (props.onBack) props.onBack();
else uni.navigateBack();
};
2025-06-15 22:01:06 +08:00
onMounted(() => {
const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios";
});
2025-05-01 21:38:35 +08:00
</script>
<template>
2025-06-18 12:32:08 +08:00
<view class="container" :style="{ paddingTop: isIos ? '38px' : '25px' }">
2025-06-17 16:42:53 +08:00
<view class="back-btn" @click="onClick">
2025-05-01 21:38:35 +08:00
<image src="../static/back.png" mode="widthFix" />
2025-06-17 16:42:53 +08:00
</view>
2025-05-01 21:38:35 +08:00
<text>{{ title }}</text>
</view>
</template>
<style scoped>
.container {
display: flex;
justify-content: flex-start;
align-items: center;
width: 72vw;
height: 60px;
2025-06-21 03:34:10 +08:00
/* margin-top: var(--status-bar-height); */
2025-05-01 21:38:35 +08:00
padding-left: 15px;
}
.back-btn {
display: flex;
align-items: center;
}
.back-btn > image {
width: 22px;
height: 22px;
margin-right: 10px;
}
.container > text {
color: #fff;
}
</style>