3d-force-graph icon indicating copy to clipboard operation
3d-force-graph copied to clipboard

How to use it on vue.js?

Open shanty1 opened this issue 4 years ago • 7 comments

The tutorial examples include js-based and react-based. I sincerely ask for a tutorial on how to use 3d-force-graph on vue.

shanty1 avatar Jan 18 '21 13:01 shanty1

@shanty1 sorry I don't have enough knowledge of vue.js to best advise how to do that integration. Possibly this is a question better asked in a vue forum since this component follows a generic format of web components.

vasturiano avatar Jan 22 '21 00:01 vasturiano

@shanty1 were you able to use this plugin in vue.js?

SvenC56 avatar Feb 26 '21 10:02 SvenC56

@SvenC56 Here's an example of the Basic example in the most simplest VueJS example: https://codepen.io/matthewmcneely/pen/QWGQVYK

matthewmcneely avatar Feb 26 '21 21:02 matthewmcneely

Hey @matthewmcneely,

thank you for the provided example! I am trying to integrate this plugin into Nuxt.js. However on SSR Page Load I get this error:

[Vue warn]: Failed to resolve async component: () => __webpack_require__.e(/*! import() | components/logo */ "components/logo").then(__webpack_require__.bind(null, /*! ../../components/Logo.vue */ "./components/Logo.vue")).then(c => c.default || c) 15:13:24
Reason: SyntaxError: Cannot use import statement outside a module

I already put the component into a <client-only> element. But it seems that this error is related to the es6 module provided by 3d-force-graph.

Did you tried to integrate this application into Nuxt?

Edit:

I already tried to add 3d-force-graph to the transpile section. But nothing changed. However I do only get this error if I open the page with the component directly. If I change from another page to the page containing the component no error is thrown.

SvenC56 avatar Mar 01 '21 14:03 SvenC56

@SvenC56 No, I was just experimenting with Vue and this project to see how they reacted together. Although from the error message you provided, it doesn't seem as though the issue is with 3d-force-graph, but your logo component. Just a hunch.

matthewmcneely avatar Mar 01 '21 16:03 matthewmcneely

Here is the vue component that you can use. Refer to https://github.com/zjfcool/vue-force-graph .

tobegit3hub avatar Jan 12 '23 11:01 tobegit3hub