omrips / viewstl

Viewstl Javascript plugin - STL/OBJ 3D files Viewer by viewstl.com
MIT License
198 stars 49 forks source link

Add library to use with VueJs or React #29

Open Kretzer6019 opened 2 years ago

Kretzer6019 commented 2 years ago

Hi!

I'm new with JS and i'm trying to add this library to work with VueJs or React.

I followed the steps using Javascript vanilla and it's worked perfectly, but when i tried to do the same thing using VueJs/React, it didn't work. Can you help me with that?

Oh, and congratulations for the project :)

omrips commented 1 year ago

Hi, the plugin is not designed to be used with React/VueJS - but I'm quite sure it is possible to do it. Can you show/send me your code and/or log?

Kretzer6019 commented 1 year ago

image This is my .vue file. When i import in this way, my log shows this error. I tried to import on main.js file or directly on html, but it shows the same error: image

omrips commented 1 year ago

It maybe because some files are missing, try to load them manually (before stl_viewer.min.js ) parser.min.js load_stl.min.js webgl_detector.js CanvasRenderer.js OrbitControls.js TrackballControls.js Projector.js three.min.js

add this parameter to the init line: load_three_files:false should look like this: var stl_viewer=new StlViewer(document.getElementById("stl_cont"), { load_three_files:false });

Hope that will work.