How can I limit an object size before it is looped in vue/nuxt?
sium_hossain
Posted on August 8, 2022
Sometimes for design requirements we have to minimize response object size or we can say response data. More clearly - Suppose, from API we receive 40 objects as response but I need only four of them. That's the one of reason GraphQL invented. GraphQL provide only those amount of data which is needed. Whatever we can slice our total response into our desire amount before printing by simply put array slice
functionality in v-for
loop-
v-for="obj in obj.slice([from:int value],[to:int value])
v-for="(i,index) in i.slice(0,4)" :key="index"
Thank you 💓
💖 💪 🙅 🚩
sium_hossain
Posted on August 8, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.