Navbar.vue
2.51 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<template>
<div class="navbar">
<hamburger :toggle-click="toggleSideBar" :is-active="sidebar.opened" class="hamburger-container"/>
<breadcrumb class="breadcrumb-container"/>
<div class="right-menu">
<!-- <span class="right-icon">
<svg-icon icon-class="ding" />
</span> -->
<img src="@/assets/images/uNoImgBg.png" class="right-image">
<span class="right-msg">
欢迎你,{{userName ? userName : '用户'}} ( {{userTaken}} )
</span>
|
<el-button @click="logout" type="text">{{ navbar.logOut }}</el-button>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import Hamburger from '@/components/Hamburger'
export default {
components: {
Breadcrumb,
Hamburger
},
data(){
return {
userName:'',
userTaken:'超级管理员',
navbar: {
logOut: '退出登录',
dashboard: '首页',
github: '项目地址',
screenfull: '全屏',
theme: '换肤',
size: '布局大小'
}
}
},
computed: {
...mapGetters([
'sidebar',
'name',
'avatar',
'device'
])
},
methods: {
toggleSideBar() {
this.$store.dispatch('toggleSideBar')
},
logout() {
this.$store.dispatch('LogOut').then(() => {
location.reload()// In order to re-instantiate the vue-router object to avoid bugs
})
}
},
mounted(){
this.userName = this.$store.getters.navbarName
this.userTaken = this.$Constants.USERTYPE[this.$store.getters.navbarType+'']
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.navbar {
height: 50px;
line-height: 50px;
border-radius: 0px !important;
.hamburger-container {
line-height: 58px;
height: 50px;
float: left;
padding: 0 10px;
}
.breadcrumb-container{
float: left;
}
.errLog-container {
display: inline-block;
vertical-align: top;
}
.right-menu {
// float: right;
height: 50px;
line-height: 50px;
display: inline-block;
position: absolute;
right: 35px;
color: #999;
& span{
display: inline-block
}
.right-icon{
height: 50px;
line-height: 50px;
margin-right: 10px;
}
.right-image {
width: 30px;
height: 30px;
border-radius: 10px;
vertical-align: middle;
margin-right: 5px;
}
.right-msg{
height: 50px;
line-height: 50px;
font-size: 14px;
}
}
}
</style>