Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
How to run a line based on user input in Javascript?

I want to run v-network-graph when the user presses enter, basically, I wrote a function that will create nodes and edges when it runs, once that function runs I want to run the line <v-network-graph @keypress.enter="gr" :nodes='nodes' :edges='edges'/> I tried writing everything inside the function but it didn't work. I am new to javascript and Vue, so I'll be grateful for any suggestions.

My template looks like this:

<template>
<div>  
  <v-network-graph @keypress.enter="gr" :nodes='nodes' :edges='edges'/>
  </div>
</template>

My function looks like this:

methods: {
    gr() {
    const nodes={}
    const edges={}
    //  const { prac } = toRefs(props)
    //  const n = reactive( prac.value )
    //  const n= prac.length
    const n = this.prac
    console.log(n.Organizations)
    for (let i = 0; i < n.length; i++) {
    nodes[`${n[i].Organizations}`] = {
    name: `${n[i].Organizations}`
  },
  nodes[`${n[i].Title}`] = {
    name: `${n[i].Title}`
  };
}
    for (let i=0;i<n.length;i++){      
      edges[`edge${i}`]={
        source:`${n[i].Organizations}`,
        target:`${n[i].Title}`
      }
    }
    console.log(nodes)
    console.log(edges)
  return { nodes, edges }
  }
 }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!