diff --git a/content/posts/21-a-beautiful-gitops-day-11/frontend.png b/content/posts/21-a-beautiful-gitops-day-11/frontend.png index 0a875ef..1b7796e 100644 Binary files a/content/posts/21-a-beautiful-gitops-day-11/frontend.png and b/content/posts/21-a-beautiful-gitops-day-11/frontend.png differ diff --git a/content/posts/21-a-beautiful-gitops-day-11/index.md b/content/posts/21-a-beautiful-gitops-day-11/index.md index 0794ffd..63084a3 100644 --- a/content/posts/21-a-beautiful-gitops-day-11/index.md +++ b/content/posts/21-a-beautiful-gitops-day-11/index.md @@ -533,27 +533,152 @@ import { getArticles } from '~/api' import type { ArticleList } from '~/api' const articles = ref([]) +const articlesCount = ref(0) + +const page = ref(1) +const size = ref(10) async function loadArticles() { const { data } = await getArticles({ - page: 1, - size: 10, + page: page.value, + size: size.value, }) articles.value = data.articles + articlesCount.value = data.articlesCount +} + +function fetchDataOnPage({ currentPage }: { currentPage: number }) { + page.value = currentPage + loadArticles() } loadArticles() +``` + +{{< /highlight >}} + +The reusable pagination component that use `useOffsetPagination` from VueUse: + +{{< highlight host="kuberocks-demo-ui" file="src/components/OffsetPagination.vue" >}} + +```vue + + + ``` @@ -583,9 +708,13 @@ getArticle()