What am i doing wrong? | model not showing up | Vuejs + modelviewer #1835
-
I'm using Vuejs, model-viewer as an npm package and Brave as a browser. You can click on the button in the browser but the model is not being shown. Could it be Brave maybe? the model is stored like this: And here is the snippet: <template>
<div id="app">
<model-viewer v-if="isMounted" :src="src" camera-controls></model-viewer>
</div>
</template> <script>
export default {
name: 'App',
data() {
return {
isMounted: false,
src: 'assets/headphone.glb'
}
},
mounted() {
this.isMounted = true;
this.loadComponent();
},
computed: {
loadComponent() {
return () => import('@google/model-viewer');
}
},
}
</script> |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 15 replies
-
We don't test on Brave, so that's possible. Have you tried it on any other browsers? |
Beta Was this translation helpful? Give feedback.
-
Hi, you are using wrong path for your files. like currently you are using Edited (15-07-2021): |
Beta Was this translation helpful? Give feedback.
-
I couldn't get it to work on NuxtJS, even though I've place my assets in |
Beta Was this translation helpful? Give feedback.
Hi, you are using wrong path for your files. like currently you are using
/src → /assets → headphone.glb
this will not work.
Your path should be /public → /assets → headphone.glb
For this purpose, you have to make public folder (if it's not there) in the same directory as src (in root directory).
Vuejs will pick up your files from there. you can access your files like this '..assets/headphone.glb' , 'assets/headphone.glb' , '../..assets/headphone.glb' depending upon your component structure.
Note: use assets folder of 'public' not of 'src' for your files.
Edited (15-07-2021):
As suggested from the @delacrixmorgan , if you are working with Nuxt then your
assets
should be in thestatic
fold…