Header.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div>
  3. <div style="display: flex; width: 100vw; justify-content: space-between; align-items: center">
  4. <div style="display: flex; padding-left: 10%">
  5. <div style="width: 120px; height: 55px; background-color: brown" />
  6. <a-menu v-model:selectedKeys="current" mode="horizontal" theme="light" style="line-height: 55px">
  7. <a-menu-item style="margin-left: 10px; margin-right: 10px" key="portal">首页</a-menu-item>
  8. <a-menu-item style="margin-left: 10px; margin-right: 10px" key="portal/resourceCenter">资源中心</a-menu-item>
  9. <a-menu-item style="margin-left: 10px; margin-right: 10px" key="portal/resourceManagement"
  10. >资源管理</a-menu-item
  11. >
  12. <a-menu-item style="margin-left: 10px; margin-right: 10px" key="portal/personalResources"
  13. >个人资源</a-menu-item
  14. >
  15. </a-menu>
  16. </div>
  17. <div class="header-right">
  18. <!-- <a-input-search placeholder="输入关键词搜索" style="width: 200px" /> -->
  19. <div style="display: flex">
  20. <SearchOutlined :style="{ fontSize: '16px', color: '#00000083' }" />
  21. <div style="width: 5px"></div>
  22. <span style="font-size: 12px; color: #00000083">搜索</span>
  23. </div>
  24. <div style="width: 20px"></div>
  25. <div style="display: flex">
  26. <UserOutlined :style="{ fontSize: '16px', color: '#00000083' }" />
  27. <div style="width: 5px"></div>
  28. <span style="font-size: 12px; color: #00000083">登录</span>
  29. </div>
  30. <div style="width: 20px"></div>
  31. <div style="display: flex">
  32. <span style="font-size: 12px; color: #00000083">注册</span>
  33. </div>
  34. <!-- <a-button type="primary">登录</a-button>
  35. <a-button>注册</a-button> -->
  36. </div>
  37. </div>
  38. <div class="line" style=""></div>
  39. </div>
  40. </template>
  41. <script setup>
  42. import { ref } from 'vue'
  43. import { useRouter, useRoute } from 'vue-router'
  44. const router = useRouter()
  45. const current = ref(['1']) // 默认选中“资源中心”
  46. const emit = defineEmits(['onChangeCurrent'])
  47. watch(
  48. () => current.value,
  49. (newVal, oldVal) => {
  50. console.log('新的是', newVal, '旧的是', oldVal)
  51. if (newVal != oldVal) {
  52. emit('onChangeCurrent', newVal)
  53. // router.push({
  54. // path: '/' + newVal
  55. // })
  56. }
  57. }
  58. )
  59. </script>
  60. <style scoped>
  61. .header {
  62. display: flex;
  63. align-items: center;
  64. justify-content: space-between;
  65. padding: 0 50px;
  66. }
  67. .header-right {
  68. display: flex;
  69. align-items: center;
  70. margin-right: 20%;
  71. }
  72. .line {
  73. width: 100%;
  74. height: 0.25px;
  75. background-color: #00000013;
  76. }
  77. </style>