Header.vue 2.6 KB

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