Closed Aravinda93 closed 3 years ago
You need to not forget to transpile as told in this section.
Then, this kind of code should make the whole thing work
<template>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<h1>Drawflow</h1>
<div id="drawflow-graph" ref="drawflow" />
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue'
export default {
data() {
return {
editor: {},
}
},
async mounted() {
const importedModule = await import('drawflow')
const Drawflow = importedModule.default
this.editor = new Drawflow(this.$refs.drawflow, Vue, this)
this.editor.start()
this.editor.addNode(
'github',
0,
1,
150,
300,
'github',
'name',
'Cool Vue example'
)
},
}
</script>
<style>
@import 'drawflow/dist/drawflow.min.css';
#drawflow-graph {
width: 800px;
height: 800px;
border: 2px solid teal;
}
</style>
Working perfectly fine on my side
@kissu Thanks for the response. Closing the issue :)
I am new to
DrawFlow
and trying to create theNodes
dynamically within theVue/Nuxtjs
application. I have followed below steps:Install the
drawflow
usingnpm i drawflow --save
Create a
drawflow.js
file underplugins
folder and add the code:Modify the
nuxt-config.js
file and add theplugin
and build:The complete code has been added in CodeSandbox.
When I run and try to add the
Node
nothing happens on theEditor
. Also, I see following error in myconsole
:Can someone please let me know what am I doing wrong? I would like to create the dynamic node something like this where for every
Add Node
button click I want to create a newNode
on the editor: