customNav.vue
1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<template>
<view class="custom-nav" :style="{ height: statusBarHeight + 'px' }">
<view :style="{ height: statusBarHeight + 'px' }"></view>
<view class="nav-content">
<view class="nav-left" @click="onBack">
<uni-icons type="left" size="24" color="#333" />
</view>
<view class="nav-title">收车偏好设置</view>
</view>
</view>
</template>
<script lang="ts">
import { Vue, Component, Prop } from 'vue-facing-decorator';
@Component({})
export default class customNav extends Vue {
// 状态栏高度(微信小程序中由系统提供)
@Prop({ type: Number, required: false, default: 48 })
statusBarHeight: number;
onBack() {
uni.showModal({
title: '提示',
content: '偏好未完成填写,稍后可在「我的-收车偏好」中继续填写',
success: (res) => {
if (res.confirm) {
uni.navigateBack();
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
}
}
</script>
<style scoped lang="scss">
.custom-nav {
width: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 999; // 确保在页面内容上方
}
.nav-content {
display: flex;
align-items: center;
justify-content: center;
position: relative;
height: 44px;
}
.nav-left {
position: absolute;
left: 2px;
width: 80rpx;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.back-icon {
font-size: 36rpx;
color: #333;
}
.nav-title {
font-size: 32rpx;
color: #333;
font-weight: 400;
}
.nav-right {
position: absolute;
right: 16rpx;
height: 100%;
display: flex;
align-items: center;
}
</style>