I am trying to show a Graph on the browser using VUE 3 in the HOME view. To do that I installed VivaGraphJS with the command
npm i vivagraphjs
Then I took the minimal example from the website https://www.npmjs.com/package/vivagraphjs and tried several ways to include it on the template, but with with no success.
<template>
<div id="graphDiv">{{graph()}}</div>
</template>
<script>
import * as Viva from '/node_modules/vivagraphjs/dist/vivagraph.js'
export default {
name: 'Home',
setup(){
const graph = () => {
let graph = Viva.Graph.graph()
graph.addLink(1, 2)
let renderer = Viva.Graph.View.renderer(graph, {
container: document.getElementById('graphDiv')
})
renderer.run()
}
return { graph }
}}
</script>
When I console.log() the renderer I can see the object in the console, so I know all the functions are working. But nothing is showed in the browser.
Thank you very much