App.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <script setup lang="ts">
  2. import { ref } from 'vue'
  3. import Scene3D from './scenes/Scene3D.vue'
  4. import DucaoScene from './scenes/DucaoScene.vue'
  5. const currentScene = ref<'scene3d' | 'ducao'>('ducao')
  6. </script>
  7. <template>
  8. <div class="app-root">
  9. <div class="scene-switcher">
  10. <button
  11. class="switch-btn"
  12. :class="{ active: currentScene === 'scene3d' }"
  13. @click="currentScene = 'scene3d'"
  14. >
  15. 主场景
  16. </button>
  17. <button
  18. class="switch-btn"
  19. :class="{ active: currentScene === 'ducao' }"
  20. @click="currentScene = 'ducao'"
  21. >
  22. 渡槽场景
  23. </button>
  24. </div>
  25. <Scene3D v-if="currentScene === 'scene3d'" :show-debug-tools="true" />
  26. <DucaoScene v-else :show-debug-tools="true" />
  27. </div>
  28. </template>
  29. <style scoped>
  30. .app-root {
  31. width: 100vw;
  32. height: 100vh;
  33. position: relative;
  34. }
  35. .scene-switcher {
  36. position: fixed;
  37. bottom: 12px;
  38. right: 12px;
  39. display: flex;
  40. flex-direction: column;
  41. gap: 6px;
  42. z-index: 9999;
  43. }
  44. .switch-btn {
  45. padding: 6px 14px;
  46. border: 1px solid rgba(255, 255, 255, 0.2);
  47. border-radius: 8px;
  48. background: rgba(0, 0, 0, 0.5);
  49. color: rgba(255, 255, 255, 0.7);
  50. font-size: 13px;
  51. cursor: pointer;
  52. transition: all 0.2s;
  53. backdrop-filter: blur(4px);
  54. font-family: 'Microsoft YaHei', sans-serif;
  55. white-space: nowrap;
  56. }
  57. .switch-btn:hover {
  58. background: rgba(255, 255, 255, 0.15);
  59. color: #fff;
  60. }
  61. .switch-btn.active {
  62. background: rgba(77, 208, 225, 0.2);
  63. border-color: #4dd0e1;
  64. color: #4dd0e1;
  65. }
  66. </style>