Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

174
Vistas
Vuejs 3 Parent child loop on same div

In Vuejs 3, I have parent child json which gives output like below.

    <div class="pbRow">
      <div>1</div>
      <div>2</div>
    </div>
    <div class="pbRow">
      <div>3</div>
      <div>4</div>
    </div>

pbRow is parent and under its child.

Now what I want is, instead of Parent pbRow multiple time, I want it only once and all parent's child in same level like

    <div class="pbRow">
      <div>1</div>
      <div>2</div>
      <div>3</div>
      <div>4</div>
    </div>

That means I only need child elements, ignoring their parent.

Below is my code

    <div class="pbRow" v-bind:key="coursePlatform" v-for="coursePlatform in filteredNestedList">
        <div :id="course.id" class="col4 col3" v-for="course in coursePlatform.courses">
        </div>
    </div>

Is there any way I can achieve what I have mentioned ? As I am not sure

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If I understood you correctly you can prepare your data with computed property and then have one loop:

const app = Vue.createApp({
  data() {
    return {
      filteredNestedList: [{courses:[{id:1},{id:2}]},{courses: [{id:3}]}],
    };
  },
  computed: {
    list() {
      return this.filteredNestedList.map(l => l.courses).flat()
    }
  }
})
app.mount('#demo')
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<div id="demo">
  <div class="pbRow" v-bind:key="coursePlatform" v-for="coursePlatform in list">
    <div :id="coursePlatform.id" class="col4 col3">{{ coursePlatform.id }}</div>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda