Header.vue 942 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <div class="fixed-header">
  3. <el-header>
  4. <el-row>
  5. <el-col :span="1">
  6. <span>logo</span>
  7. </el-col>
  8. <el-col :span="1" :push="22"
  9. ><div class="sign-out" @click="signOut">{{ userType }}退出</div></el-col
  10. >
  11. </el-row>
  12. </el-header>
  13. </div>
  14. </template>
  15. <script>
  16. export default {
  17. props: {
  18. userType: {
  19. type: String,
  20. default: ''
  21. }
  22. },
  23. methods: {
  24. async signOut() {
  25. await this.$store.dispatch('user/signOut');
  26. this.$router.push(`/login?redirect=${this.$route.fullPath}`);
  27. }
  28. }
  29. };
  30. </script>
  31. <style lang="scss" scoped>
  32. .fixed-header {
  33. position: fixed;
  34. top: 0;
  35. right: 0;
  36. width: 100%;
  37. z-index: 9;
  38. .el-header {
  39. height: $header-h !important;
  40. line-height: $header-h;
  41. background-color: $bacColor;
  42. text-align: center;
  43. .sign-out {
  44. cursor: pointer;
  45. font-size: 12px;
  46. }
  47. }
  48. }
  49. </style>