header.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div class="header">
  3. 后台管理系统
  4. <div class="user-info">
  5. <el-dropdown trigger="click" @command="handleCommand">
  6. <span class="el-dropdown-link">
  7. <img class="user-logo" src="../../../static/img/img.jpg">
  8. linxin
  9. </span>
  10. <el-dropdown-menu slot="dropdown">
  11. <el-dropdown-item command="loginout">退出</el-dropdown-item>
  12. </el-dropdown-menu>
  13. </el-dropdown>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. sName: 'abcd'
  22. }
  23. },
  24. methods:{
  25. handleCommand(command) {
  26. if(command == 'loginout'){
  27. console.log(1)
  28. this.$router.push('/login');
  29. }
  30. },
  31. loginOut(){
  32. }
  33. }
  34. }
  35. </script>
  36. <style scoped>
  37. .header {
  38. position: relative;
  39. box-sizing: border-box;
  40. padding-left: 50px;
  41. width: 100%;
  42. height: 70px;
  43. font-size: 22px;
  44. line-height: 70px;
  45. color: #fff;
  46. background-color: #242f42;
  47. }
  48. .user-info {
  49. float: right;
  50. padding-right: 50px;
  51. font-size: 16px;
  52. color: #fff;
  53. }
  54. .user-info .el-dropdown-link{
  55. position: relative;
  56. display: inline-block;
  57. padding-left: 50px;
  58. color: #fff;
  59. cursor: pointer;
  60. vertical-align: middle;
  61. }
  62. .user-info .user-logo{
  63. position: absolute;
  64. left:0;
  65. top:15px;
  66. width:40px;
  67. height:40px;
  68. border-radius: 50%;
  69. }
  70. .el-dropdown-menu__item{
  71. text-align: center;
  72. }
  73. </style>