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
| <!--
| * @Author: 小明丶
| * @Date: 2019-08-15 15:44:44
| * @LastEditors: zxq
| * @LastEditTime: 2022-08-30 16:46:40
| * @Description: 头部组件
| -->
| <template>
| <div class="nav-bar flex-start-g" :class="[fixed ? 'fixed' : '']" :style="{'background':background}">
| <!-- <slot name="left-back"> -->
| <svg class="icon" aria-hidden="true" style="width:25px;height:44px;" @click="go">
| <use xlink:href="#iconzuojiantou"></use>
| </svg>
| <!-- </slot> -->
| <h4 class="title text-center-g" :style="{'color':titleColor}">{{title}}</h4>
| <div class="rightText" @click="rightClick">
| <slot name="right">{{rightText}}</slot>
| </div>
| </div>
| </template>
|
| <script>
| export default {
| name: 'v-navbar',
| props: {
| title: {
| type: String,
| require: true,
| },
| rightText: {
| type: String,
| },
| fixed:{
| type:Boolean,
| default:false
| },
| back:{
| type:String,
| },
| background:{
| type:String,
| default:'#fff'
| },
| titleColor:{
| type:String
| },
|
| },
| methods:{
| rightClick(){
| this.$emit('right-click')
| },
| go(){
| if(this.back){
| this.$router.push(this.back)
| }else{
| this.$router.back()
| }
| }
| }
| }
| </script>
|
| <style lang="less" scoped>
| .nav-bar {
| background-color: @c-bg-fff;
| .lh(44px);
| position: relative;
| padding: 0 20px;
| z-index: @zIndex-100;
| &.fixed{
| position: fixed;
| top: 0;
| left: 0;
| right: 0;
| }
|
| .icon {
| z-index: @zIndex-20;
| }
|
| .title {
| font-size: @font-16;
| position: absolute;
| left: 60px;
| right: 60px;
| }
|
| .rightText {
| font-size: @font-14;
| position: absolute;
| right: 20px;
| height: 44px;
| min-width: 50px;
| text-align: right;
| }
| }
| </style>
|
|