Giter Site home page Giter Site logo

Comments (3)

h-ikeda avatar h-ikeda commented on June 24, 2024

Thank you for having a time with VueGL and posting a problem.

Well, sorry but example components currently only supports IIFE and THREE must be loaded globally.

Additionally, you are trying to register the component before unpkg script loaded because the mounted() hook is called very after loading modules.

So that you should load the additional script from unpkg before starting Vue instance, maybe in file like index.js, app.js or main.js...

You also have to pay attention to the variable scope. IIFE script set the component under the global VueGL object, but in module VueGL is an imported local object.
To access global one, window.VueGL is the way.

Actually, of course you must be exhausted in this way, I guess. More directly approach is, making the example components loadable via npm package. I will fix it as soon as possible.

from vue-gl.

h-ikeda avatar h-ikeda commented on June 24, 2024

@WaDadidou
I worked around it and release v0.22.0 .

Please update your local vue-gl version first.

npm install vue-gl@latest

Then, you can import the example component (VglObjLoader) in modules.
Try to insert codes that imports and registers the component like below.

import * as VueGL from 'vue-gl';
import VglObjLoader from 'vue-gl/dist/examples/loaders/vgl-obj-loader'; // <- insert this

Object.entries(VueGL).forEach([id, component] => Vue.component(id, component))
Vue.component('VglObjLoader', VglObjLoader); // <- registering our example component

Of course, you can also register the component locally with the component option (as you wrote but commented out in your screenshot).

from vue-gl.

WaDadidou avatar WaDadidou commented on June 24, 2024

Hi, thank you ! <3

from vue-gl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.