|
@@ -16,17 +16,17 @@
|
|
|
<div class='flex-child-average flex-justify-end flex padding-right '>
|
|
|
<div class='padding flex flex-align-center'>
|
|
|
<el-avatar class='mr-10' :size="30" src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" />
|
|
|
- <el-dropdown>
|
|
|
- <span class="el-dropdown-link">
|
|
|
- 第五季
|
|
|
+ <el-dropdown @command='dropDown'>
|
|
|
+ <span class="flex flex-center">
|
|
|
+ {{user.info.user_name}}
|
|
|
<el-icon class="el-icon--right">
|
|
|
<arrow-down />
|
|
|
</el-icon>
|
|
|
</span>
|
|
|
<template #dropdown>
|
|
|
<el-dropdown-menu>
|
|
|
- <el-dropdown-item>个人中心</el-dropdown-item>
|
|
|
- <el-dropdown-item>退出登录</el-dropdown-item>
|
|
|
+ <el-dropdown-item command='info'>个人中心</el-dropdown-item>
|
|
|
+ <el-dropdown-item command='logout'>退出登录</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</template>
|
|
|
</el-dropdown>
|
|
@@ -38,17 +38,30 @@
|
|
|
|
|
|
<script>
|
|
|
import navStore from '../store/nav.js'
|
|
|
+import { useStore } from '../store/user.js'
|
|
|
|
|
|
export default {
|
|
|
name: 'top',
|
|
|
setup () {
|
|
|
const nav = navStore()
|
|
|
- return { nav }
|
|
|
+ const user = useStore()
|
|
|
+ return { nav, user }
|
|
|
},
|
|
|
created () {
|
|
|
this.nav.$subscribe((res) => {
|
|
|
console.log(res.events.target)
|
|
|
})
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ dropDown (res) {
|
|
|
+ if (res === 'info') {
|
|
|
+ this.$message.success('个人中心')
|
|
|
+ } else if (res === 'logout') {
|
|
|
+ this.nav.cleanMenu()
|
|
|
+ this.$message.success('退出登录')
|
|
|
+ this.$router.replace('/login')
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|