navigationBar.vue
1.54 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
82
<template>
<view class="navigation" :style="{height: getNavigationHeight}">
<view class="back_btn" :style="{marginTop: statusHeight}" @click="backClick">
<image class="image" src="../static/navigation_back.png" mode="aspectFit"></image>
</view>
<view class="title" :style="{top: statusHeight}">{{title}}</view>
</view>
</template>
<script>
export default {
props: {
title: String
},
data() {
return {
}
},
computed: {
safeAreaInsets() {
return uni.getSystemInfoSync().safeAreaInsets.bottom
},
statusHeight() {
let device = uni.getSystemInfoSync();
return device.statusBarHeight + "px";
},
getNavigationHeight() {
var h = 0;
let device = uni.getSystemInfoSync();
let statusBarHeight = device.statusBarHeight;
h += 44;
return h + "px";
}
},
onLoad() {
},
methods: {
backClick() {
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
.navigation {
display: flex;
flex-direction: row;
position: relative;
background: linear-gradient(to right, #D82222, #B81F1F);
// justify-content: center;
align-items: center;
.back_btn {
display: flex;
width: 44px;
height: 44px;
justify-content: center;
align-items: center;
.image {
width: 20px;
height: 20px;
}
}
.title {
display: flex;
// position: absolute;
top: 0;
left: 50%;
right: 50%;
height: 44px;
width: 100%;
margin-right: 44px;
justify-content: center;
align-items: center;
flex-direction: row;
color: #FFE8C3;
}
}
</style>