Header.vue
1.43 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
<template>
<div class="header">
<div class="left">
</div>
<div class="right">
<div class="author">
<i class="icon el-icon-s-custom" />
{{ props.name || '' }}
<el-tag size="small" effect="dark" class="logout" @click="logout">退出</el-tag>
</div>
</div>
</div>
</template>
<script>
import { getCurrentInstance,onMounted } from 'vue'
import { useRouter } from 'vue-router'
export default {
name: 'Header',
props:['name'],
setup (props) {
const router = useRouter()
const internalInstance = getCurrentInstance()
const logout = () => {
let apiUrl = internalInstance.appContext.config.globalProperties.apiUrl
localStorage.clear()
location.href=`http://10.238.0.183/base/ssologin/logout?redirect_uri=${apiUrl}`//新昌内网
// location.href=`http://61.175.247.164:9366/base/ssologin/logout?redirect_uri=${apiUrl}`//21公司的服务器
}
// console.log(props.name)
return {
logout,
props
}
}
}
</script>
<style scoped>
.header {
height: 85px;
/* border-bottom: 1px solid #e9e9e9; */
box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.03);
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 40px;
}
.right > div > .icon {
font-size: 18px;
margin-right: 6px;
}
.logout {
cursor: pointer;
margin-left: 10px;
line-height: 24px;
}
.author{
display: flex;
align-items: center;
}
</style>