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

104 lines
2.2 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-07-15 15:15:47 +08:00
<view class="container" :style="{ paddingTop: isIos ? '76rpx' : '50rpx' }">
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-06-25 00:09:53 +08:00
<view>
2025-07-11 00:47:34 +08:00
<block
v-if="
'-凹造型-感知距离-小试牛刀'.indexOf(title) === -1 ||
'-凹造型-感知距离-小试牛刀'.indexOf(title) === 10
"
>
2025-06-25 00:09:53 +08:00
<text>{{ title }}</text>
</block>
2025-07-11 00:47:34 +08:00
<block
v-if="
title &&
'-凹造型-感知距离-小试牛刀'.indexOf(title) !== -1 &&
'-凹造型-感知距离-小试牛刀'.indexOf(title) !== 10
"
>
2025-06-25 00:09:53 +08:00
<view class="first-try-steps">
2025-07-11 00:47:34 +08:00
<text :class="title === '-凹造型' ? 'current-step' : ''">凹造型</text>
2025-06-28 12:03:33 +08:00
<text>-</text>
2025-07-11 00:47:34 +08:00
<text :class="title === '-感知距离' ? 'current-step' : ''"
2025-06-25 00:09:53 +08:00
>感知距离</text
>
2025-06-28 12:03:33 +08:00
<text>-</text>
2025-07-11 00:47:34 +08:00
<text :class="title === '-小试牛刀' ? 'current-step' : ''"
2025-06-25 00:09:53 +08:00
>小试牛刀</text
>
</view>
</block>
</view>
2025-05-01 21:38:35 +08:00
</view>
</template>
<style scoped>
.container {
display: flex;
justify-content: flex-start;
align-items: center;
width: 72vw;
2025-07-15 15:15:47 +08:00
height: 120rpx;
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;
2025-06-25 00:09:53 +08:00
color: #fff;
font-size: 16px;
2025-07-11 22:21:34 +08:00
font-weight: bold;
2025-05-01 21:38:35 +08:00
}
.back-btn {
display: flex;
align-items: center;
}
.back-btn > image {
width: 22px;
height: 22px;
margin-right: 10px;
}
2025-06-25 00:09:53 +08:00
.first-try-steps {
display: flex;
align-items: center;
color: #fff6;
font-size: 14px;
}
.first-try-steps > text {
transition: all 0.3s ease;
}
.first-try-steps > text:nth-child(2),
.first-try-steps > text:nth-child(4) {
margin: 0 5px;
}
.current-step {
font-size: 16px;
2025-05-01 21:38:35 +08:00
color: #fff;
}
</style>