comHead.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="dashboard-head flex">
  3. <!-- <div class="dashboard-head-title">{{title}}</div> -->
  4. <div class="dashboard-head-tabs flex-wrap">
  5. <div
  6. class="dashboard-head-tabs-list"
  7. :class="tabsIndex == index ? 'active' : ''"
  8. @click="tabClick(item, index)"
  9. v-for="(item, index) in tabs"
  10. :key="index"
  11. >
  12. {{ item.label }}
  13. </div>
  14. </div>
  15. <!-- <div class="dashboard-head-zw"></div> -->
  16. </div>
  17. </template>
  18. <script setup lang="ts">
  19. import { ref } from "vue";
  20. const router = useRouter();
  21. const props = defineProps({
  22. tabsIndex: {
  23. type: Number,
  24. default: 0,
  25. },
  26. });
  27. const tabs = [
  28. {
  29. id: 1,
  30. label: "国内出港",
  31. value: "one",
  32. },
  33. {
  34. id: 2,
  35. label: "国内进港",
  36. value: "two",
  37. },
  38. {
  39. id: 3,
  40. label: "国际出港",
  41. value: "three",
  42. },
  43. {
  44. id: 4,
  45. label: "国际进港",
  46. value: "four",
  47. },
  48. ];
  49. const { tabsIndex } = props;
  50. const tabClick = (item, index) => {
  51. if (index == 0) {
  52. router.push({
  53. path: "../homeOut",
  54. });
  55. }
  56. if (index == 1) {
  57. router.push({
  58. path: "../homein",
  59. });
  60. }
  61. if (index == 2) {
  62. router.push({
  63. path: "../indexOut",
  64. });
  65. }
  66. if (index == 3) {
  67. router.push({
  68. path: "../indexIn",
  69. });
  70. }
  71. };
  72. </script>
  73. <style lang="scss" scoped>
  74. .dashboard-head {
  75. &-tabs {
  76. font-size: 16px;
  77. font-family: Microsoft YaHei;
  78. font-weight: 400;
  79. color: #ffffff;
  80. &-list {
  81. margin-right: 60px;
  82. cursor: pointer;
  83. position: relative;
  84. &:last-child {
  85. margin-right: 0;
  86. }
  87. }
  88. .active {
  89. color: #51dee9;
  90. &::after {
  91. content: "";
  92. position: absolute;
  93. bottom: 0;
  94. width: 80%;
  95. left: 10%;
  96. height: 2px;
  97. background: #51dee9;
  98. }
  99. }
  100. }
  101. }
  102. </style>