floor-tab.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div class="floor-btn" v-if="floorCount > 1">
  3. <div
  4. v-for="item in floorList"
  5. :key="item.key"
  6. :class="['quisk-item', item.key == nowSelect ? 'active' : '']"
  7. @click="floor(item.key)"
  8. >
  9. <span>{{ item.text }}</span>
  10. </div>
  11. </div>
  12. </template>
  13. <script lang="ts" setup>
  14. import { custom } from "@/env";
  15. import { getSupperPanoModel } from "@/sdk/association";
  16. import { currentModel, fuseModel } from "@/model";
  17. import { flyModel } from "@/hook/use-fly";
  18. import { ref, onMounted, watch } from "vue";
  19. import { SDK, sdk } from "@/sdk";
  20. import { useViewStack } from "@/hook";
  21. const nowSelect = ref("all");
  22. const floorList = ref([
  23. {
  24. key: "all",
  25. text: "全部",
  26. },
  27. ] as any[]);
  28. const floor = (num: any) => {
  29. sdk.goFloor(num);
  30. nowSelect.value = num;
  31. };
  32. const floorCount = ref(sdk.getFloorCount());
  33. sdk.sceneBus.on("floorCount", (count) => {
  34. floorCount.value = count;
  35. });
  36. watch(
  37. floorCount,
  38. (newVal) => {
  39. console.log("watch", newVal);
  40. for (let i = 0; i < newVal; i++) {
  41. floorList.value.push({
  42. key: i,
  43. text: `${i + 1}楼`,
  44. });
  45. }
  46. },
  47. { immediate: true }
  48. );
  49. </script>
  50. <style lang="scss" scoped>
  51. .floor-btn {
  52. position: absolute;
  53. bottom: calc(var(--editor-menu-bottom, 0px) + 10px);
  54. left: calc(var(--left-pano-left) + var(--left-pano-width));
  55. margin-left: 24px;
  56. // display: flex;
  57. // flex-direction: column;
  58. // align-items: center;
  59. z-index: 100;
  60. width: 60px;
  61. min-height: 126px;
  62. background: rgba(27, 27, 28, 0.8);
  63. border-radius: 20px;
  64. padding: 8px;
  65. transition: all 0.3s ease;
  66. .active {
  67. background: #00c8af;
  68. }
  69. .quisk-item {
  70. width: 100%;
  71. height: 40px;
  72. border-radius: 10px;
  73. display: flex;
  74. align-items: center;
  75. justify-content: center;
  76. color: #fff;
  77. cursor: pointer;
  78. }
  79. }
  80. </style>