I am trying to integrate the @jsplumb/browser-ui
community edition into my application. As per the recommendation from jsplumb
team, I am using the @jsplumb/browser-ui
but I am not understanding how to start integrating it into my Vue/Nuxtjs application
.
Following are the steps I am following:
- Install the
@jsplumb/browser-ui
usingnpm install @jsplumb/browser-ui --save
. - Include the libraries in the
nuxt-config.js
as part ofscript
:
script: [
{
src:"node_modules/@jsplumb/core/js/jsplumb.core.umd.js",
mode: 'client'
},
{
src:"node_modules/@jsplumb/browser-ui/js/jsplumb.browser-ui.umd.js",
mode: 'client'
}
]
- I have the code as follows:
<template>
<div class="row">
<div class="col-md-12">
<div id="diagram" style="position: relative" />
</div>
</div>
</template>
<script>
if (process.browser) {
const jsPlumbBrowserUI = require('node_modules/@jsplumb/browser-ui/js/jsplumb.browser-ui.umd.js')
const instance = jsPlumbBrowserUI.newInstance({
container: document.getElementById('diagram')
})
console.log(instance)
}
export default {
mounted () {
if (process.browser) {
console.log('MOUNTED BLOCK')
}
}
}
</script>
I am not understanding how to integrate it within my application. The documentation does not provide a complete example with regards to Vue/Nuxtjs
$ref
and inmounted
to await for the DOM being mounted properly. You could even use$nextTick
if it does not work accordingly. vuejs.org/v2/guide/… – Georgy