|
@@ -19,15 +19,14 @@
|
|
|
<img src="../../assets/img/img.jpg" />
|
|
|
</div>
|
|
|
<!-- 用户名下拉菜单 -->
|
|
|
- <el-dropdown class="user-name" trigger="hover" @command="handleCommand">
|
|
|
+ <el-dropdown class="user-name" trigger="hover">
|
|
|
<span class="el-dropdown-link">
|
|
|
{{ user.name || '游客' }}
|
|
|
- <i class="el-icon-caret-bottom"></i>
|
|
|
</span>
|
|
|
- <el-dropdown-menu slot="dropdown">
|
|
|
- <el-dropdown-item divided command="loginout">退出登录</el-dropdown-item>
|
|
|
- </el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
+ <div class="btn">
|
|
|
+ <button @click="loginout"><i class="el-icon-switch-button"></i></button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -47,11 +46,9 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
// 用户名下拉菜单选择事件
|
|
|
- handleCommand(command) {
|
|
|
- if (command == 'loginout') {
|
|
|
- localStorage.removeItem('token');
|
|
|
- this.$router.push('/login');
|
|
|
- }
|
|
|
+ loginout() {
|
|
|
+ localStorage.removeItem('token');
|
|
|
+ this.$router.push('/login');
|
|
|
},
|
|
|
// 侧边栏折叠
|
|
|
collapseChage() {
|
|
@@ -168,4 +165,15 @@ export default {
|
|
|
.el-dropdown-menu__item {
|
|
|
text-align: center;
|
|
|
}
|
|
|
+.btn {
|
|
|
+ margin: 0 0 0 10px;
|
|
|
+}
|
|
|
+.btn button:hover {
|
|
|
+ cursor: pointer;
|
|
|
+ background-color: #409eff;
|
|
|
+ color: #fff;
|
|
|
+}
|
|
|
+.btn button i {
|
|
|
+ font-size: 25px;
|
|
|
+}
|
|
|
</style>
|