Commit bcd77b64315b914a7259ae0a00f7e96dec30f9ee
Merge branch 'fix/model-size-change' into 'main_dev'
fix: 修复模型尺寸变化重新渲染 See merge request yunteng/thingskit-view!311
Showing
1 changed file
with
7 additions
and
1 deletions
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | </div> |
10 | 10 | </template> |
11 | 11 | <script setup lang="ts"> |
12 | -import { PropType, toRefs, unref, shallowRef, onMounted, onBeforeMount, ref } from 'vue' | |
12 | +import { PropType, toRefs, unref, shallowRef, onMounted, onBeforeMount, ref, watch } from 'vue' | |
13 | 13 | import { CreateComponentType } from '@/packages/index.d' |
14 | 14 | import { ModelLoader } from './modelLoader' |
15 | 15 | import { doGet3DComponentJson } from '@/api/external/3dModel' |
... | ... | @@ -54,6 +54,12 @@ onMounted(() => { |
54 | 54 | unref(modelContainerElRef)?.appendChild(loader.renderer.domElement) |
55 | 55 | loader.addControls() |
56 | 56 | }) |
57 | + | |
58 | +watch( | |
59 | + () => [w.value, h.value], | |
60 | + () => { | |
61 | + loader.renderer.setSize(unref(w), unref(h)) | |
62 | + }) | |
57 | 63 | </script> |
58 | 64 | |
59 | 65 | <style lang="scss" scoped> | ... | ... |