Header.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <script setup lang="ts">
  2. import {CirclePlus, UserFilled, SwitchButton} from "@element-plus/icons-vue";
  3. import {ref} from 'vue';
  4. import {router} from '../router'
  5. const searchContent = ref('')
  6. function logout() {
  7. ElMessageBox.confirm(
  8. '是否要退出登录?',
  9. '提示',
  10. {
  11. customClass: "customDialog",
  12. confirmButtonText: '是',
  13. cancelButtonText: '否',
  14. type: "warning",
  15. showClose: false,
  16. roundButton: true,
  17. center: true
  18. }
  19. ).then(() => {
  20. sessionStorage.setItem('token', '')
  21. router.push({path: "/login"})
  22. }).catch(() => {
  23. // do nothing
  24. })
  25. }
  26. function search() {
  27. //todo: search
  28. }
  29. </script>
  30. <template>
  31. <el-header class="customHeader" height="20">
  32. <el-row :gutter="20" :justify="'space-between'">
  33. <el-col :span="4">
  34. <router-link to="/allStore" v-slot="{navigate}">
  35. <h1 @click="navigate" class="text-xl text-white"> 蓝鲸在线购物 </h1>
  36. </router-link>
  37. </el-col>
  38. <el-col :span="10">
  39. </el-col>
  40. <el-col :span="2">
  41. <router-link to="/manager/createStore" v-slot="{navigate}">
  42. <el-icon @click="navigate" :size="30" color="white" ><CirclePlus /></el-icon>
  43. </router-link>
  44. </el-col>
  45. <el-col :span="2">
  46. <router-link to="/dashboard" v-slot="{navigate}">
  47. <el-icon @click="navigate" :size="30" color="white" ><UserFilled /></el-icon>
  48. </router-link>
  49. </el-col>
  50. <el-col :span="2">
  51. <a @click="logout">
  52. <el-icon :size="30" color="white" ><SwitchButton /></el-icon>
  53. </a>
  54. </el-col>
  55. </el-row>
  56. </el-header>
  57. </template>
  58. <style scoped>
  59. .customHeader {
  60. background-color: #79bbff;
  61. }
  62. </style>