Closed aminvandh closed 1 year ago
What vue-3d-loader version and nuxt version are you using?
Use vue-3d-loader in nuxt2, you need install version 1.2.14 or other 1.x.x
version.
If you use nuxt2, example:
vue-3d-loader-plugin.js
import Vue from 'vue'
import vue3dLoader from 'vue-3d-loader'
Vue.use(vue3dLoader)
- Add the plugin to `nuxt.config.js`
```js
plugins: [
{ src: '@/plugins/vue-3d-loader-plugin', mode: 'client' }
],
<!-- the 3d model files must be placed in static folders -->
<vue3dLoader :file-path="'/models/gltf/DamagedHelmet.gltf'" />
Thanks, nextcloud uses Vue 2.7 and i don't have nuxt installed. still can load model with new vue project (v3.*) but not with this one
You can try install vue-3d-loader version 1.2.14 in your nextcloud project. In the vue2 must use vue-3d-loader@1.x.x
, in the vue3 use vue-3d-loader@2.x.x
.
Thanks for help, errors are gone, but nothing shows up, its maybe my issue. src/main.js:
import App from './App'
import vue3dLoader from 'vue-3d-loader'
import Vue from 'vue'
// eslint-disable-next-line
__webpack_public_path__ = generateFilePath(appName, '', 'js/')
Vue.mixin({ methods: { t, n } })
Vue.use(vue3dLoader);
export default new Vue({
el: "#content",
render: h => h(App),
})
i put *.glb file in img, and use :
<vue3dLoader :file-path="'../img/house.glb'" />
Thanks for help, errors are gone, but nothing shows up, its maybe my issue. src/main.js:
import App from './App'
import vue3dLoader from 'vue-3d-loader'
import Vue from 'vue'
// eslint-disable-next-line
__webpack_public_path__ = generateFilePath(appName, '', 'js/')
Vue.mixin({ methods: { t, n } })
Vue.use(vue3dLoader);
export default new Vue({
el: "#content",
render: h => h(App),
})
Set height/width or scale. More info you can view document https://king2088.github.io/vue-3d-loader-docs/guide/api.html
Your glb file must be accessible through a url. It is recommended to place the file in the public or static directory.
If your glb file in the public directory, the filePath
don't add '/public/', look like this:
<vue-3d-loader filePath="/house.glb"/>
path is fine, i think its a router issue, which won't let that access
path is fine, i think its a router issue, which won't let that access
Your glb file http url is 404(not found),the url not access, so you need a glb file path that can be accessed through a url. In the vue project project, the public directory is not processed by webpack, if your build your front-end project, the public directory all files is in root directory. So in the vue your want access your public directory files, you can directly access the files in the root directory.
if you have a file in public shch as public/a.glb
, you can use http://localhost:8080/a.glb, don't use http://localhost:8080/public/a.glb. So your vue file look like this:
<vue-3d-loader filePath="/a.glb"/>
Of course, most of the time, your glb files are stored directly on an http server, so you can simply place your glb files on another http server that can be accessed through a url, such as using http server locally.
apps/
, is not '/'.http:localhost:8080/index.php/apps/public/house.glb
, I think your glb file url may be is http://localhost:8080/apps/public/house.glb
. So you can use your browser access http://localhost:8080/apps/public/house.glb
, if can download the house.glb
, you can try this code:
<vue-3d-loader filePath="http://localhost:8080/apps/public/house.glb"/>
Hope to help you.
other tags like <img work well with files in any directory.
I tried to add this into nextcloud project but it leaves me with warnings:
WARNING in ./node_modules/vue-3d-loader/dist/vue-3d-loader.esm.js 42057:13-22 export 'openBlock' (imported as 'openBlock') was not found in 'vue' (possible exports:
WARNING in ./node_modules/vue-3d-loader/dist/vue-3d-loader.esm.js 42057:26-44 export 'createElementBlock' (imported as 'createElementBlock') was not found in 'vue' (possible exports:
WARNING in ./node_modules/vue-3d-loader/dist/vue-3d-loader.esm.js 42062:8-26 export 'createElementVNode' (imported as 'createElementVNode') was not found in 'vue' (possible exports: