Index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <div class="loan-header">
  3. <div class="header-content pf600 fs16 fc1F2937">
  4. <img
  5. class="left-arrow-image"
  6. src="@/assets/icon/index/left-arrow.svg"
  7. @click="toPath()" />
  8. 订单列表
  9. <div class="save">
  10. <img src="@/assets/icon/asset/rili.png" alt="" />
  11. </div>
  12. </div>
  13. </div>
  14. <div class="notifi-classifi">
  15. <div
  16. class="classifi-item"
  17. :class="current == 'all' ? 'current-classifi' : 'pf600 fs14 fcA8A8A8'"
  18. @click="messageChange('all')">
  19. 全部
  20. <div class="active-line" v-if="current == 'all'"></div>
  21. </div>
  22. <div
  23. class="classifi-item"
  24. :class="current == 'buy' ? 'current-classifi' : 'pf600 fs14 fcA8A8A8'"
  25. @click="messageChange('buy')">
  26. 购买
  27. <div class="active-line" v-if="current == 'buy'"></div>
  28. </div>
  29. <div
  30. class="classifi-item"
  31. :class="current == 'sell' ? 'current-classifi' : 'pf600 fs14 fcA8A8A8'"
  32. @click="messageChange('sell')">
  33. 出售
  34. <div class="active-line" v-if="current == 'sell'"></div>
  35. </div>
  36. </div>
  37. <component :is="currentComponent" />
  38. </template>
  39. <script setup>
  40. import All from "./All.vue";
  41. import Buy from "./Buy.vue";
  42. import Sell from "./Sell.vue";
  43. import { ref, computed } from "vue";
  44. import { useRoute, useRouter } from "vue-router";
  45. const router = useRouter();
  46. const current = ref("all");
  47. const componentsMap = {
  48. all: All,
  49. buy: Buy,
  50. sell: Sell,
  51. };
  52. const currentComponent = computed(() => componentsMap[current.value]);
  53. const messageChange = (key) => {
  54. current.value = key;
  55. };
  56. const toPath = () => {
  57. router.push("/");
  58. };
  59. </script>
  60. <style lang="less" scoped>
  61. .loan-header {
  62. position: fixed;
  63. left: 0;
  64. top: 0;
  65. z-index: 1;
  66. width: 100%;
  67. height: 48px;
  68. background: #ffffff;
  69. overflow: hidden;
  70. .header-content {
  71. display: flex;
  72. flex-direction: row;
  73. justify-content: center;
  74. align-items: center;
  75. position: relative;
  76. width: 100%;
  77. height: 48px;
  78. .left-arrow-image {
  79. position: absolute;
  80. left: 14px;
  81. top: 16px;
  82. width: 9px;
  83. height: 16px;
  84. }
  85. .save {
  86. position: absolute;
  87. top: 15px;
  88. right: 16px;
  89. img {
  90. width: 15px;
  91. height: 16px;
  92. }
  93. }
  94. }
  95. }
  96. .notifi-classifi {
  97. display: flex;
  98. flex-direction: row;
  99. justify-content: flex-start;
  100. align-items: flex-end;
  101. margin: 0 auto;
  102. margin-top: 48px;
  103. width: 345px;
  104. height: 24px;
  105. .classifi-item {
  106. position: relative;
  107. margin-left: 43px;
  108. .active-line {
  109. position: absolute;
  110. bottom: -6px;
  111. left: 50%;
  112. transform: translateX(-50%);
  113. width: 20px;
  114. height: 3px;
  115. background-color: #323233;
  116. border-radius: 2px;
  117. }
  118. &:first-child {
  119. margin-left: 0;
  120. }
  121. }
  122. .current-classifi {
  123. font-family: "PingFang SC";
  124. font-style: normal;
  125. font-weight: 600;
  126. font-size: 14px;
  127. color: #121212;
  128. transition: color 0.3s, font-size 0.3s;
  129. }
  130. }
  131. </style>