index.vue
895 Bytes
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
<template>
<u-navbar :leftIconColor="leftIconColor" :leftIcon="canBack ? 'arrow-left' : ''" placeholder
@leftClick="handleBack()" color="#fff" :bgColor="bgColor">
<view class="flex justify-center align-center text-lg" :style="{color:textColor}" slot="center">
{{title}}
</view>
</u-navbar>
</template>
<script>
export default {
props: {
title: {
type: String,
default: ''
},
canBack: {
type: Boolean,
default: false
},
bgColor: {
type: String,
default: '#fff'
},
leftIconColor: {
type: String,
default: '#303133'
},
textColor:{
type: String,
default: '#303133'
}
},
mounted() {
// console.log('canBack', this.canBack)
},
methods: {
handleBack() {
if (!this.canBack) {
return
}
// console.log('返回')
this.$goBack()
}
}
}
</script>
<style scoped lang="scss">
</style>