Repository navigation
Expand file tree
/
Copy pathhead.vue
More file actions
95 lines (88 loc) · 2.42 KB
/
Copy pathhead.vue
File metadata and controls
95 lines (88 loc) · 2.42 KB
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
<template>
<header id='head_top'>
<slot name='logo'></slot>
<slot name='search'></slot>
<section class="head_goback" v-if="goBack" @click="$router.go(-1)">
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" version="1.1">
<polyline points="12,18 4,9 12,0" style="fill:none;stroke:rgb(255,255,255);stroke-width:2"/>
</svg>
</section>
<router-link :to="userInfo? '/profile':'/login'" v-if='signinUp' class="head_login">
<svg class="user_avatar" v-if="userInfo">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#user"></use>
</svg>
<span class="login_span" v-else>登录|注册</span>
</router-link>
<section class="title_head ellipsis" v-if="headTitle">
<span class="title_text">{{headTitle}}</span>
</section>
<slot name="edit"></slot>
<slot name="msite-title"></slot>
<slot name="changecity"></slot>
<slot name="changeLogin"></slot>
</header>
</template>
<script>
import {mapState, mapActions} from 'vuex'
export default {
data(){
return{
}
},
mounted(){
//获取用户信息
this.getUserInfo();
},
props: ['signinUp', 'headTitle', 'goBack'],
computed: {
...mapState([
'userInfo'
]),
},
methods: {
...mapActions([
'getUserInfo'
]),
},
}
</script>
<style lang="scss" scoped>
@import '../../style/mixin';
#head_top{
background-color: $blue;
position: fixed;
z-index: 100;
left: 0;
top: 0;
@include wh(100%, 1.95rem);
}
.head_goback{
left: 0.4rem;
@include wh(0.6rem, 1rem);
line-height: 2.2rem;
margin-left: .4rem;
}
.head_login{
right: 0.55rem;
@include sc(0.65rem, #fff);
@include ct;
.login_span{
color: #fff;
}
.user_avatar{
fill: #fff;
@include wh(.8rem, .8rem);
}
}
.title_head{
@include center;
width: 50%;
color: #fff;
text-align: center;
.title_text{
@include sc(0.8rem, #fff);
text-align: center;
font-weight: bold;
}
}
</style>