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

104
Views
Cómo agregar datos específicos a niños anidados en la biblioteca javascript he-tree-vue

El siguiente es un ejemplo de una matriz de objetos, donde los datos constan de cuatro niveles de datos anidados.

aquí muestro los datos de los niños en he-tree-vue cuando el usuario presiona el interruptor en un elemento específico y luego realiza una solicitud a la API, por lo que luego los datos se agregan a un cierto valor de matriz en función de los datos existentes para mostrarse como datos del niño.

 [{ // class ClassID:"0ede11", Title:"Mandiri", children:[{ // course/subject CourseID:"0ec2", Title:"Math", children:[ // chapter { ChapterId:"0ss23", Title:"Test test", }, { ChapterId:"0ss23", Title:"Test test" }, { ChapterId:"0se22", Title:"Test test" }, ] }, { CourseID:"rere43", Title:"History", children:[ { ChapterId:"0sse56", Title:"Test test", }, { ChapterId:"0ss2qqq3", Title:"Test test" }, { ChapterId:"0sefg22", Title:"Test test" }, ] } ] }]

¿Cómo agrego datos a niños específicos? Aquí uso la biblioteca he-tree-vue para mostrar un árbol de datos que se puede arrastrar.

ahora uso el siguiente código, pero solo funciona en el primer niño.

 getChapter(id, index) { this.API.getChapter(id, (data) => { console.log(data); // I'm still confused in this part, how to dynamically add data to specific child data at each level const newData = [...this.playlistData]; newData[index].children[index].children = data; this.playlistData = newData; }, (err) => { console.log(err); }); }

Gracias.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Ok resuelto, solo necesito guardar cada índice en cada nivel y luego usarlo cuando vaya a agregar datos.

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