0

I need limit items from hackernews API.How can I do that? Code is:

<template>

    <p>Products</p>
<div>
  <div class="grid grid-cols-4 gap-5">
    <div v-for="s in results" :key="story">
      <ProductCard :story="s"/>
    </div>
  </div> 
</div>
</template>
<script setup>
  definePageMeta({
    layout: "products"
  })

  const { data: stories } = await useFetch('https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty')
  

  </script>

I tried:

  const { data: stories } = await useFetch('https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty').limit(1000)

but no result.

kissu
  • 40,416
  • 14
  • 65
  • 133
Azizxon Zufarov
  • 107
  • 1
  • 3
  • 8

1 Answers1

0

according to this there is a default limit of 500 items but there is no option to limit the items you will get, you can store the whole 500 items in an array and display the number of items you want by changing the array using map,for loop filter etc ...

MrXQ
  • 465
  • 8
  • 25