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
<template>
<view class="topbar_view" :style="[{'color': titleColor, 'background-color': bgColor}, bold ? {'font-weight':900} : 'initial']">
<text class="eosfont left_icon" @click="back()"></text>
{{this.title}}
</view>
</template>
<script>
export default {
props: {
title: {
type: String,
default: ''
},
titleColor: {
type: String,
default: '#212121'
},
bgColor: {
type: String,
default: '#fff'
},
bold: {
type: Boolean,
default: false
}
},
methods: {
back() {
const routes = getCurrentPages();
if(routes.length > 1){
uni.navigateBack();
}else{
history.back();
}
}
}
}
</script>
<style lang="less" scoped>
.topbar_view {
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #212121;
font-size: 30rpx;
position: fixed;
left: 0;
top: 0;
width: 100%;
background-color: #fff;
z-index: 100;
.left_icon {
position: absolute;
left: 20rpx;
}
}
</style>