detail.vue 834 B

1234567891011121314151617181920212223242526272829303132
  1. <template>
  2. <div style="width: 100%; height: calc(100vh - 200px); display: flex; justify-content: center; align-items: center">
  3. <a-spin :spinning="loading" />
  4. <div id="fengmen3D" v-show="!loading"> </div>
  5. </div>
  6. </template>
  7. <script setup lang="ts">
  8. import { ref, onMounted, onUnmounted } from 'vue';
  9. import UseThree from '../../../../utils/threejs/useThree';
  10. const loading = ref(false);
  11. let model;
  12. onMounted(() => {
  13. model = new UseThree('#fengmen3D');
  14. // model.setEnvMap('test');
  15. // model.setCustomMaterial = setCustomMaterial
  16. loading.value = true;
  17. model.setGLTFModel('9f-processed').then(() => {
  18. // 模型加载成功
  19. loading.value = false;
  20. });
  21. });
  22. onUnmounted(() => {
  23. if (model) {
  24. model.destroy();
  25. }
  26. });
  27. </script>
  28. <style scoped lang="less"></style>