Good afternoon everyone!
I’m stuck since 3 days searching answers in forums and here also, and i can’t solve it.. Maybe you can help about this problem:
In javascript is easier, but in NUXT we can’t insert Javascript where we wan’t..
In the component page:
<script>
async fetch() {
this.ArraySkills= await fetch(`https://api.test/player/${id}`
).then((res) => res.json ())
},
data () {
return {
ArraySkills: []
}
}
</script>
This url is a test. But it’s return an array about skills of player 1. I already display the skills of this player.
But i need to display the forEach players, their skills (40 players).
I created an ArraySkills. And i would like to visit the url1, url2, url3 etc.. And to push() inside the ArraySkills
In pure JS i would done :
let id=1
while (id<41) {
id++;
async fetch() {
this.ArraySkill= await fetch(`https://api.test/player/${id}`
).then((res) => res.json ())
},
ArraySkills.push(ArraySkill);
}
#And then he will fill the ArraySkills with the 40 players
But in Nuxt it's seems harder :/