[Vuejs]-V-for doesn't go through my dynamic multidimensional array on Vue 2

1👍

Does this work for you?

var av = new Vue({
  el: '#validaciones',
  data: {
    vChallenges: ['CH1', 'CH2', 'CH3'],
    vPlayers: ['p1', 'p2', 'p3', 'p4'],
    vContest: [
      { ch: 'CH1', pl: ['p1', 'p2', 'p3', 'p4'] },
      { ch: 'CH2', pl: ['p1', 'p2', 'p3', 'p4'] },
      { ch: 'CH3', pl: ['p1', 'p2', 'p3', 'p4'] }
    ],
    vDynamicPlayers: [],
  },
  computed:{
    vDynamicContest(){
      return this.vChallenges.map(c => {
        return {
          ch: c, 
          pl:[...this.vPlayers]
        }
      })
    }
  }
})

Example.

👤Bert

1👍

Use a computed property instead:

computed: {
  vDynamicContest: function() {
    return this.vChallenges.map((challenge) => {
      return { ch: challenge, pl: this.vPlayers }
    })
  },
},

Here’s a working codepen example.

Leave a comment