[Vuejs]-NUXT JS insert Array inside Array and display forEach

0👍

Be aware forEach not support async methods, you have to use regular for or while

data() {
    return {
      ArraySkills: [],
    };
  },
  async fetch() {
    await this.fillArray();
  },
  methods: {
    async fillArray() {
      let id = 1;
      while (id < 41) {
        id++;
        const response = await fetch(`https://api.test/player/${id}`);
        const ArraySkill = response.json();
        this.ArraySkills.push(ArraySkill);
      }
    },
  },

Leave a comment