vue-babylonjs
vue-babylonjs copied to clipboard
v-model binding for Scene does not work - remains uninitialized
When using <Scene v-model="myScene" ….>
the myScene data element does not initialize.
The workaround I use is to capture the scene object in the onScene event and store in in myScene. However, in the vue dev tools for chrome, myScene is consistently reported as "unknown object" and can not be explored. Logging myScene to console does show the internals of the scene.
If you use the @scene
or @complete
events on the component do you have an initialized object?
It's probable that you are trying to access that object before it's completely initialized like in a mounted
or created
hook.
Try something like this:
<template>
<Scene @scene="onScene">
<!-- stuff in scene -->
</Scene>
</template>
<script>
export default {
methods: {
onScene(scene) {
// should be fired when the scene object has been initialized
},
},
};
</script>
As for the devtools reporting the object, is it possible that you're binding to a nested object in data? Vue won't react to nested properties. Can you share a minimum reproduction on glitch.com or something similar?
Hey @kgeusens I was able to verify that the scene v-model
is not being initialized in the source. I'll patch and let you know when that's released. Apologies for the inconvenience.
Any progress on this? I just hit this bug too
If you use the
@scene
or@complete
events on the component do you have an initialized object?
This work around works for me.
@johnflux Yeah the @scene
event workaround is the supported solution. There are some general issues with scene v-model
binding that may have to wait for [email protected] to solve.
@BrainBacon I LOVE U SO MUCH FOR YOU COMMENT ON 3 Mar 2019, MY DUDE !!!!!!!!!!!! You really saved my project dude.