index.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <LeftPano>
  3. <SceneList :current="currentModel" @update:current="loadModel" />
  4. </LeftPano>
  5. <RightFillPano>
  6. <template #header>
  7. <div class="tabs">
  8. <span
  9. v-for="tab in tabs"
  10. :key="tab.key"
  11. :class="{ active: tab.key === current }"
  12. @click="current = tab.key"
  13. >
  14. {{ tab.text }}
  15. </span>
  16. </div>
  17. </template>
  18. <Taggings v-if="current === TabKey.tagging" />
  19. <Guides v-if="current === TabKey.guide" />
  20. <Measures v-if="current === TabKey.measure" />
  21. </RightFillPano>
  22. </template>
  23. <script setup lang="ts">
  24. import { ref, watchEffect } from "vue";
  25. import { useViewStack } from "@/hook";
  26. import { showRightCtrlPanoStack, showRightPanoStack } from "@/env";
  27. import { currentModel, fuseModel, loadModel } from "@/model";
  28. import { LeftPano, RightFillPano } from "@/layout";
  29. import SceneList from "@/layout/scene-list/index.vue";
  30. import Taggings from "@/views/tagging/hot/show.vue";
  31. import Measures from "@/views/measure/show.vue";
  32. import Guides from "@/views/guide/show.vue";
  33. enum TabKey {
  34. tagging,
  35. measure,
  36. guide,
  37. }
  38. const tabs = [
  39. { key: TabKey.tagging, text: "标签" },
  40. { key: TabKey.measure, text: "测量" },
  41. { key: TabKey.guide, text: "路径" },
  42. ];
  43. const current = ref(tabs[0].key);
  44. const showRightCtrl = ref(true);
  45. watchEffect((onclean) => {
  46. const isFuse = currentModel.value === fuseModel;
  47. if (!isFuse) {
  48. onclean(showRightPanoStack.push(ref(false)));
  49. }
  50. showRightCtrl.value = isFuse;
  51. });
  52. useViewStack(() => showRightCtrlPanoStack.push(showRightCtrl));
  53. </script>
  54. <style lang="scss" scoped>
  55. .tabs {
  56. height: 60px;
  57. border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  58. display: flex;
  59. margin: -20px;
  60. margin-bottom: 20px;
  61. > span {
  62. flex: 1;
  63. display: flex;
  64. align-items: center;
  65. justify-content: center;
  66. position: relative;
  67. transition: color 0.3s ease;
  68. cursor: pointer;
  69. font-size: 16px;
  70. &::after {
  71. content: "";
  72. transition: height 0.3s ease;
  73. position: absolute;
  74. background-color: #00c8af;
  75. left: 0;
  76. right: 0;
  77. bottom: 0;
  78. height: 0;
  79. }
  80. &:hover,
  81. &.active {
  82. color: #00c8af;
  83. }
  84. &.active::after {
  85. height: 3px;
  86. }
  87. }
  88. }
  89. </style>