header.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <div class="header">
  3. <div class="bg"></div>
  4. <div class="logo center">
  5. <img src="@/assets/images/delicious/logo.png" alt="" />
  6. <span>飞鸟有味</span>
  7. </div>
  8. <div class="tabs center">
  9. <div
  10. :class="['tab-item center', { active: index === active }]"
  11. @click="handleActive(index)"
  12. v-for="(item, index) in tabs"
  13. :key="index"
  14. >
  15. {{ item }}
  16. </div>
  17. </div>
  18. <div class="search">
  19. <el-input
  20. v-model="input"
  21. prefix-icon="Search"
  22. style="width: 340px"
  23. placeholder="搜索水果名称/地区"
  24. />
  25. </div>
  26. </div>
  27. </template>
  28. <script setup>
  29. import { ref } from "vue";
  30. const active = ref(0);
  31. const tabs = ["首页","有味介绍", "有味指数", "地理风物", "关于我们"];
  32. const handleActive = (i) => {
  33. active.value = i;
  34. };
  35. const input = ref("");
  36. </script>
  37. <style lang="scss" scoped>
  38. .header {
  39. width: 100%;
  40. height: 70px;
  41. box-sizing: border-box;
  42. background: linear-gradient(90deg, #eb8e8e 0%, #ffeeef 80%);
  43. display: flex;
  44. align-items: center;
  45. color: #fff;
  46. position: relative;
  47. .center {
  48. display: flex;
  49. align-items: center;
  50. }
  51. .logo {
  52. font-size: 30px;
  53. font-weight: 400;
  54. letter-spacing: 2px;
  55. position: relative;
  56. z-index: 2;
  57. margin-right: 70px;
  58. img {
  59. width: 30px;
  60. height: 30px;
  61. margin: 0 20px 0 30px;
  62. }
  63. span {
  64. font-family: "PangMenZhengDao";
  65. }
  66. }
  67. .tabs {
  68. height: 100%;
  69. position: relative;
  70. z-index: 2;
  71. margin-right: 30px;
  72. .tab-item {
  73. font-weight: 400;
  74. font-size: 20px;
  75. width: 110px;
  76. height: 100%;
  77. justify-content: center;
  78. text-align: center;
  79. margin-right: 33px;
  80. cursor: pointer;
  81. font-family: "PangMenZhengDao";
  82. &.active {
  83. background: #fff;
  84. color: #f56d83;
  85. }
  86. }
  87. }
  88. .search {
  89. ::v-deep {
  90. .el-input__wrapper {
  91. box-shadow: none;
  92. border-radius: 20px;
  93. }
  94. }
  95. }
  96. .bg {
  97. width: 100%;
  98. height: 100%;
  99. position: absolute;
  100. z-index: 0;
  101. background: url("@/assets/images/delicious/header-bg.png") no-repeat center
  102. center / 100% 100%;
  103. }
  104. }
  105. </style>