forked from Spikef/vmc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavbar.vue
54 lines (50 loc) · 1.25 KB
/
navbar.vue
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
<template>
<topbar class="vmc-navbar" :style="style" v-if="show">
<slot name="main">
<div class="left" @click="_onBack">
<i class="icono-caretLeft"></i>
</div>
<div class="center">
<slot></slot>
</div>
<div class="right" @click="_onMenu"></div>
</slot>
</topbar>
</template>
<script type="text/ecmascript-6">
import Topbar from './topbar.vue';
import { env } from '../../utils';
export default {
components: {
Topbar
},
props: {
color: String,
backColor: String,
fontSize: String
},
methods: {
_onBack() {
window.history.back();
this.$emit('on-back');
},
_onMenu() {
this.$emit('on-menu');
}
},
computed: {
style() {
return {
color: this.color,
backgroundColor: this.backColor,
fontSize: this.fontSize
}
}
},
data() {
return {
show: !env.isWechat
}
}
}
</script>