header.vue
3.05 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<template>
<div class="blk-header-wrap" :class="[class, {'is-fixed': fixed}]">
<div class="blk-header">
<div class="blk-header-left">
<slot name="left">
<i class="icon icon-left" @click="goBack"></i>
</slot>
</div>
<div class="blk-header-right">
<slot name="right"></slot>
</div>
<div class="blk-header-main">
<span class="blk-header-title">{{title}}</span>
</div>
</div>
<div class="blk-header-gap" v-if="!fixed"></div>
</div>
</template>
<script>
const yoho = require('yoho');
module.exports = {
props: {
title: String,
class: [String, Object, Array],
fixed: Boolean,
scrollFix: Boolean
},
methods: {
goBack() {
yoho.goBack({}, function() {}, function() {});
}
}
};
</script>
<style>
.blk-header-wrap.ghost {
.blk-header {
background-color: rgba(255, 255, 255, 0);
transition: 0.3s all;
border-bottom: 0;
}
.blk-header-title {
opacity: 0;
}
}
.blk-header-wrap.ghost-2 {
.blk-header {
background-color: rgba(255, 255, 255, 0.4);
transition: 0.3s all;
border-bottom: 0;
}
.blk-header-title {
opacity: 0.3;
}
}
.blk-header-wrap.ghost-3 {
.blk-header {
background-color: rgba(255, 255, 255, 0.7);
transition: 0.3s all;
border-bottom: 0;
}
.blk-header-title {
opacity: 0.7;
}
}
.blk-header {
box-sizing: content-box;
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 210;
padding: 20px 34px;
height: 70px;
max-width: 750px;
margin-left: auto;
margin-right: auto;
line-height: 70px;
font-size: 48px;
background-color: #fff;
border-bottom: 1px solid #eee;
color: #000;
.icon,
.blk-header-title {
vertical-align: middle;
}
}
.blk-header-main {
display: block;
text-align: center;
margin-left: auto;
margin-right: auto;
font-size: 42px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
position: absolute;
left: 0;
right: 0;
z-index: -1;
}
.blk-header-left {
float: left;
font-size: 42px;
}
.blk-header-right {
float: right;
font-size: 45px;
span {
margin-left: 30px;
}
}
.blk-header-gap {
height: calc(70 + 20 * 2 + 1)px;
background-color: transparent;
}
.app.ios {
.blk-header {
padding-top: 60px;
}
.blk-header-gap {
height: calc(70 + 20 * 2 + 40 + 1)px;
}
}
</style>