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
| <template>
| <van-nav-bar :title="title" :left-arrow="showLeft" @click-left="onClickLeft">
| <template #title>
| <slot name="title"></slot>
| </template>
| <template #right>
| <slot name="right"></slot>
| </template>
| </van-nav-bar>
| </template>
|
| <script setup>
| import { useRouter } from 'vue-router'
| const emit = defineEmits(['back'])
| const props = defineProps({
| title: {
| type: String,
| default: ''
| },
| // 是否路由返回
| back: {
| default: true
| },
| showLeft: {
| type: Boolean,
| default: true
| },
| })
|
| const router = useRouter();
|
| // 返回
| const onClickLeft = () => {
| return props.back ? router.back() : emit('back')
| }
|
| </script>
|
| <style lang="scss" scoped>
| :deep(.van-icon) {
| font-size: 18px;
| // color: $text_color;
| color: $log-c;
| }
|
| :deep(.van-nav-bar__title) {
| color: $log-c;
| }
| </style>
|
|