Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

453
Visualizações
How to get started with the @jsplumb/browser-ui in the Vuejs/Nuxtjs application?

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:

  1. Install the @jsplumb/browser-ui using npm install @jsplumb/browser-ui --save.
  2. Include the libraries in the nuxt-config.js as part of script:
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'
      }
    ]
  1. 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

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Using dynamic imports as shown in this previous answer and importing the jsplumb package only in a browser context solved the issue that OP faced.

On top of using $refs for the DOM selection.

over 4 years ago · Santiago Trujillo Relatório

0

Following worked for me based on @kissu comments:

<template>
  <div class="row">
    <div class="col-md-12">
      <div id="diagram" ref="diagram" style="position: relative" />
    </div>
  </div>
</template>

<script>
export default {
  async mounted () {
    if (process.browser) {
      const jsPlumbBrowserUI = await import('@jsplumb/browser-ui')

      const instance = jsPlumbBrowserUI.newInstance({
        container: this.$refs.diagram
      })
      console.log(instance)
    }
  }
}
</script>
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda