1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

defineComponent for model loaders (#10)

This commit is contained in:
Kevin Levron 2021-04-04 21:02:46 +02:00
parent 98c74aa1c4
commit 2dae67458f
3 changed files with 9 additions and 6 deletions

View File

@ -1,7 +1,8 @@
import { defineComponent } from 'vue';
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader.js'; import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader.js';
import Model from './Model.js'; import Model from './Model.js';
export default { export default defineComponent({
extends: Model, extends: Model,
props: { props: {
src: String, src: String,
@ -12,4 +13,4 @@ export default {
this.onLoad(fbx); this.onLoad(fbx);
}, this.onProgress, this.onError); }, this.onProgress, this.onError);
}, },
}; });

View File

@ -1,7 +1,8 @@
import { defineComponent } from 'vue';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'; import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
import Model from './Model.js'; import Model from './Model.js';
export default { export default defineComponent({
extends: Model, extends: Model,
props: { props: {
src: String, src: String,
@ -12,4 +13,4 @@ export default {
this.onLoad(gltf.scene); this.onLoad(gltf.scene);
}, this.onProgress, this.onError); }, this.onProgress, this.onError);
}, },
}; });

View File

@ -1,6 +1,7 @@
import { defineComponent } from 'vue';
import Object3D from '../core/Object3D.js'; import Object3D from '../core/Object3D.js';
export default { export default defineComponent({
extends: Object3D, extends: Object3D,
emits: ['load', 'progress', 'error'], emits: ['load', 'progress', 'error'],
data() { data() {
@ -21,4 +22,4 @@ export default {
this.$emit('error', error); this.$emit('error', error);
}, },
}, },
}; });