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

201
Visualizações
How to create an event with Setup in vue js?

So I want to update my graph which I am creating using v-network-graphs, when a user enters a value in the input box.

setup(props,oa) {
    const nodes={}
    const edges={}
    const { prac } = toRefs(props)
    const n = reactive( prac.value )
    //  const n= prac.length
    for (let i = 0; i < n.length; i++) {
    nodes[`${n[i].oa}`] = {
    name: `${n[i].oa}`
  },
  nodes[`${n[i].Title}`] = {
    name: `${n[i].Title}`
  };
}
    for (let i=0;i<n.length;i++){      
      edges[`edge${i}`]={
        source:`${n[i].oa}`,
        target:`${n[i].Title}`
      }
    }   
    return { nodes, edges }
  }

So basically I want to replace oa with the value that the user enters and update the graph. I tried writing a method and updating the graph but it's not working, the graph just shows undefined as oa doesn't exist in the data.

This is my div

<div>
  <GraphWorld :nodes='nodes' :edges='edges'/>
  <input @keyup.enter="o" v-model="name2" />
  </div>

and this is my method (I have tried writing the method in other ways to, nothing is working)

methods: {
    o(){
      this.oa = this.name2
      console.log(this.oa)
    }
  }

I am new to javascript and vue, I will be grateful if you guys have any suggestions.

about 4 years ago · Juan Pablo Isaza
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