diff --git a/components/pagination-item.vue b/components/pagination-item.vue new file mode 100644 index 0000000..d1deece --- /dev/null +++ b/components/pagination-item.vue @@ -0,0 +1,49 @@ + + + diff --git a/pages/news/index.vue b/pages/news/index.vue index f839782..9fa525d 100644 --- a/pages/news/index.vue +++ b/pages/news/index.vue @@ -11,7 +11,7 @@
+ + @@ -60,4 +66,12 @@ const { data } = await useAsyncData('news-items-list', () => .sort({ date: -1 }) .find(), ) + +const currentPage = ref(1) +const itemPerPage = 9 + +const paginatedData = computed(() => { + const startIndex = itemPerPage * (currentPage.value - 1) + return data.value?.slice(startIndex, startIndex + itemPerPage) +})