Header.vue 2.7 KB

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