I need help making my blog summary page more dynamic by using a q-carousel to display 3 blog posts per slide. I want to create an array with all the blog posts and loop through it with v-for to populate each slide dynamically while keeping the pagination linked. Any suggestions on how to achieve this grouping?
Here's a snippet of my code:
<template>
<div class="skew-cc"></div>
<div class="tw-bg-white tw-py-24 sm:tw-py-32">
<div class="tw-mx-auto tw-max-w-7xl tw-px-6 lg:tw-px-8">
<div class="service-block q-pa-lg text-center column no-wrap flex-center block-wrapper" id="Blog">
<h2 class="text-h2 text-weight-bolder text-dark q-mb-xs">Useful Articles</h2>
<h6 class="text-h6 text-weight-light text-dark q-my-none" style="max-width: 800px;">We hope to share some of our knowledge to help you make an informed decision!</h6>
</div>
<q-carousel
v-model="slide"
transition-prev="slide-right"
transition-next="slide-left"
animated
control-color="primary"
class="full-height full-width"
>
<q-carousel-slide name="1" class="column no-wrap flex-center">
<div class="tw-mx-auto tw-mt-16 tw-grid tw-max-w-2xl tw-grid-cols-1 tw-gap-x-8 tw-gap-y-20 lg:tw-mx-0 lg:tw-max-w-none lg:tw-grid-cols-3">
<article v-for="post in posts" :key="post.id" class="tw-flex tw-flex-col tw-items-start tw-justify-between">
<div class="tw-relative tw-w-full">
<q-img :src="post.imageUrl" alt="" class="aspect-[16/9] w-full rounded-2xl bg-gray-100 object-cover sm:aspect-[2/1] lg:aspect-[3/2]" />
<div class="absolute inset-0 rounded-2xl ring-1 ring-inset ring-gray-900/10" />
</div>
<div class="tw-max-w-xl">
<div class="tw-mt-8 tw-flex tw-items-center tw-gap-x-4 tw-text-xs">
<time :datetime="post.datetime" class="tw-text-gray-500">{{ post.date }}</time>
<a :href="post.category.href" class="tw-relative tw-z-10 tw-rounded-full tw-bg-gray-50 tw-px-3 tw-py-1.5 tw-font-medium tw-text-gray-600 hover:tw-bg-gray-100">{{ post.category.title }}</a>
</div>
<div class="tw-group tw-relative">
<h3 class="tw-mt-3 tw-text-lg tw-font-semibold tw-leading-6 tw-text-gray-900 group-hover:tw-text-gray-600">
<a :href="post.href">
<span class="tw-absolute tw-inset-0" />
{{ post.title }}
</a>
</h3>
<p class="tw-mt-5 tw-line-clamp-3 tw-text-sm tw-leading-6 tw-text-gray-600">{{ post.description }}</p>
</div>
<div class="tw-relative tw-mt-8 tw-flex tw-items-center tw-gap-x-4">
<img :src="post.author.imageUrl" alt="" class="tw-h-10 tw-w-10 tw-rounded-full tw-bg-gray-100" />
<div class="tw-text-sm tw-leading-6">
<p class="tw-font-semibold tw-text-gray-900">
<a :href="post.author.href">
<span class="tw-absolute tw-inset-0" />
{{ post.author.name }}
</a>
</p>
<p class="tw-text-gray-600">{{ post.author.role }}</p>
</div>
</div>
</div>
</article>
</div>
</q-carousel-slide>
</q-carousel>
<div class="q-pa-lg q-mt-xl flex flex-center">
<q-pagination
v-model="currentPage"
:max="2"
direction-links
/>
</div>
</div>
</div>
</template>
<script setup>
import { ref , watch} from 'vue'
const currentPage = ref(1);
const slide = ref('1');
const posts = [
// Array of blog posts here
]
watch(currentPage, (currentValue, oldValue) => {
slide.value = currentValue.toString();
});
</script>
<style lang="scss" scoped>
/* CSS styles go here */
</style>