[SOLVED] Fetch AXIOS on vue but only the first 100

Issue

This Content is from Stack Overflow. Question asked by swnz

How can I fetch only the first 100 items randomly:

if I use this <ActorList v-for="actors in list" :key="actors.id" :actors= "actors"/>
from an api, my browser crashes as its too much data.

im using this under script

data() {
return {
list: []
};
},
async mounted() {
const result = await axios.get("https://api.tvmaze.com/people");
console.log(result.data);
this.list = result.data;
},
components: { ActorList }
}



Solution

send params for pagination in your axios request
i think there is a problem with the API but if it wasnt use computed and filter method to filter your object
somthing like this :
list.filter((a, index) => index < 10)


This Question was asked in StackOverflow by swnz and Answered by AliRjbzdeh It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?