Box.vue 513 B

1234567891011121314151617181920212223242526272829
  1. <script setup lang="ts">
  2. import { TresColor } from '@tresjs/core/dist/types'
  3. import { shallowRef } from 'vue'
  4. withDefaults(
  5. defineProps<{
  6. args?: number[]
  7. color?: TresColor
  8. }>(),
  9. {
  10. args: () => [1, 1, 1],
  11. color: '0xffffff',
  12. },
  13. )
  14. const boxRef = shallowRef()
  15. defineExpose({
  16. value: boxRef,
  17. })
  18. </script>
  19. <template>
  20. <TresMesh ref="boxRef" v-bind="$attrs">
  21. <TresBoxGeometry :args="args" />
  22. <slot>
  23. <TresMeshBasicMaterial :color="color" />
  24. </slot>
  25. </TresMesh>
  26. </template>