Kitware / vue-vtk-js

Vue.js based components for vtk.js
33 stars 8 forks source link

Vue 3 run issue #8

Open ivankusuma07 opened 1 week ago

ivankusuma07 commented 1 week ago
import { createApp, Vue } from 'vue';

import { createPinia } from 'pinia';
import router from '@/router';
import App from './App.vue';

import VTK from 'vue-vtk-js';

const app = createApp(App);

app.use(createPinia());
app.use(router);
app.use(VTK);
app.mount('#app');

How to run this on Vue 3? I got error like this when running it.

image

jourdain commented 1 week ago

try

import 'vue-vtk-js';

app.use(window.vue_vtk);

or

import { install } from 'vue-vtk-js';

app.use({ install });
ivankusuma07 commented 1 week ago

Still got an error and cannot show 3D file from url. image

I call it like

 <vtk-view>
       <vtk-geometry-representation>
           <vtk-reader vtkClass="vtkOBJReader" :url="`https://github.com/ivankusuma07/test/blob/master/cottage_obj.obj`" />
       </vtk-geometry-representation>
 </vtk-view>
jourdain commented 1 week ago

But that is not the same one as before... So for that one, it is because we did not pre-compiled the vue components and rely on the vue library that still has the compiler in it. That is how we manage a component that works with either vue2 and vue3.

Keep in mind that you could bundle vue-vtk-js into yours by importing the source of it instead of the generated bundle.