passes vue js data to component
This commit is contained in:
parent
081063647d
commit
16d8616f16
|
@ -4,3 +4,7 @@
|
|||
padding: 1em;
|
||||
background-color: lightgray;
|
||||
}
|
||||
|
||||
#object {
|
||||
height: 500px;
|
||||
}
|
||||
|
|
|
@ -23,13 +23,6 @@
|
|||
>
|
||||
</model-gltf>
|
||||
%end
|
||||
%if object['type'] == "obj-mtl":
|
||||
<model-obj
|
||||
src="{{ object['urls'][0] }}"
|
||||
mtl="{{ object['urls'][1] }}"
|
||||
>
|
||||
</model-obj>
|
||||
%end
|
||||
%if object['type'] == "obj":
|
||||
<model-obj
|
||||
src="{{ object['urls'][0] }}"
|
||||
|
@ -48,15 +41,6 @@
|
|||
>
|
||||
</model-stl>
|
||||
%end
|
||||
%if object['type'] == "dae":
|
||||
<model-collada
|
||||
:backgroundAlpha="0"
|
||||
@on-load="onLoad"
|
||||
:rotation="rotation"
|
||||
src="{{ object['urls'][0] }}"
|
||||
>
|
||||
</model-collada>
|
||||
%end
|
||||
%if object['type'] == "json":
|
||||
<model-three
|
||||
:backgroundAlpha="0"
|
||||
|
@ -68,19 +52,59 @@
|
|||
%end
|
||||
%if object['type'] == "ply":
|
||||
<model-ply
|
||||
src="{{ object['urls'][0] }}"
|
||||
:backgroundAlpha="0"
|
||||
@on-load="onLoad"
|
||||
:rotation="rotation"
|
||||
src="{{ object['urls'][0] }}"
|
||||
|
||||
>
|
||||
</model-ply>
|
||||
%end
|
||||
|
||||
%if object['type'] == "dae":
|
||||
<model-collada
|
||||
src="{{ object['urls'][0] }}"
|
||||
:rotation="rotation"
|
||||
@on-load="onLoad"
|
||||
>
|
||||
</model-collada>
|
||||
%end
|
||||
%if object['type'] == "obj-mtl":
|
||||
<model-obj
|
||||
src="{{ object['urls'][0] }}"
|
||||
mtl="{{ object['urls'][1] }}"
|
||||
:backgroundAlpha="0"
|
||||
@on-load="onLoad"
|
||||
:height="height"
|
||||
>
|
||||
</model-obj>
|
||||
%end
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: "#object"
|
||||
})
|
||||
|
||||
new Vue({
|
||||
el: "#object",
|
||||
data: {
|
||||
height: 500,
|
||||
loading: true,
|
||||
rotation: {
|
||||
x: -Math.PI / 2,
|
||||
y: 0,
|
||||
z: 0,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onLoad () {
|
||||
this.loading = true;
|
||||
//this.rotate();
|
||||
},
|
||||
rotate () {
|
||||
this.rotation.z += 0.01;
|
||||
requestAnimationFrame( this.rotate );
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue