header.vue
1.78 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<template>
<view>
<div :style="{ height: navheight + 'px',background:'#0069FF'}" ></div>
<view class="indexNav">
<text class="left" @tap="lClick">{{leftText}}</text>
<image :src="leftImgSrc" class="lImg" @tap="lClick"></image>
{{title}}
<span class="right" @tap="rClick">{{rightText}}</span>
<image :src="rightImgSrc" class="rImg" @tap="rClick"></image>
</view>
<view class="blanks">
</view>
</view>
</template>
<script>
export default{
data(){
return{
navheight:0
}
},
created(){
uni.getStorage({
key:'statusBarH',
success:(res)=>{
if(res.data){
this.navheight=res.data;
}
}
})
},
props:{
leftText:{
type:String,
default:''
},
rightText:{
type:String,
default:''
},
leftImgSrc:{
type:String,
default:''
},
rightImgSrc:{
type:String,
default:''
},
title:{
type:String,
default:''
}
},
methods: {
rClick() {
this.$emit('rightClick')
},
lClick(){
this.$emit('leftClick')
}
}
}
</script>
<style>
.indexNav{
height: 77.89upx;
line-height: 77.89upx;
text-align: center;
background: #0069FF;
position: fixed;
font-size:33upx;
color:rgba(255,255,255,1);
width: 100%;
z-index: 9;
}
.blanks{
height: 77.89upx;
}
.left{
float: left;
font-size:25.36upx;
display: inline-block;
height: 77.89upx;
line-height: 77.89upx;
padding-left: 23.55upx;
}
.right{
position: absolute;
font-size:25.36upx;
display: inline-block;
height: 77.89upx;
line-height: 77.89upx;
right: 21.73upx;
}
.lImg{
width: 12.68upx;
height: 23.55upx;
float: left;
position: relative;
top: 27.17upx;
}
.rImg{
width: 28.98upx;
height: 28.98upx;
top: 27.17upx;
right: 18.12upx;
position: absolute;
}
</style>