HeaderLayout.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <div class="header">
  3. <div class="tool">
  4. <a-icon type="menu-unfold" @click="$emit('clickUnFold')"/>
  5. </div>
  6. <div class="user-wrapper">
  7. <set-language class="set_lang" />
  8. <a href="/">
  9. <a-icon type="home"/>
  10. </a>
  11. <a @click="logout" style="margin-left: 20px">
  12. <a-icon type="logout"/>
  13. </a>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import SetLanguage from '@/components/SetLanguage/SetLanguage'
  19. export default {
  20. name: 'HeaderComponent',
  21. components: {SetLanguage},
  22. methods: {
  23. logout() {
  24. this.$api.auth.logout().then(() => {
  25. this.$message.success('注销成功')
  26. this.$router.push('/login')
  27. })
  28. }
  29. }
  30. }
  31. </script>
  32. <style lang="less" scoped>
  33. .header {
  34. height: 64px;
  35. padding: 0 20px 0 0;
  36. background: #fff;
  37. box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.05);
  38. border-bottom: 1px solid #e8e8e8;
  39. @media (prefers-color-scheme: dark) {
  40. background: #28292c;
  41. box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  42. border-bottom: unset;
  43. }
  44. position: fixed;
  45. width: 100%;
  46. }
  47. .tool {
  48. position: fixed;
  49. left: 20px;
  50. @media (min-width: 512px) {
  51. display: none;
  52. }
  53. }
  54. .user-wrapper {
  55. position: fixed;
  56. right: 20px;
  57. }
  58. .set_lang {
  59. display: inline;
  60. margin-right: 25px;
  61. }
  62. </style>