From 25a1a0d4493e003e20770aebe72d7d56dac782d9 Mon Sep 17 00:00:00 2001 From: Phong Nguyen Date: Wed, 1 Jan 2025 11:59:49 +0700 Subject: [PATCH] Pagination Component --- src/UIs/vuejs/src/components/Pagination.vue | 97 +++++++++++++++++++++ src/UIs/vuejs/src/views/auditlogs/List.vue | 32 ++++--- 2 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 src/UIs/vuejs/src/components/Pagination.vue diff --git a/src/UIs/vuejs/src/components/Pagination.vue b/src/UIs/vuejs/src/components/Pagination.vue new file mode 100644 index 000000000..511d2d56a --- /dev/null +++ b/src/UIs/vuejs/src/components/Pagination.vue @@ -0,0 +1,97 @@ + + + diff --git a/src/UIs/vuejs/src/views/auditlogs/List.vue b/src/UIs/vuejs/src/views/auditlogs/List.vue index f9c7d2005..a6c9e2de9 100644 --- a/src/UIs/vuejs/src/views/auditlogs/List.vue +++ b/src/UIs/vuejs/src/views/auditlogs/List.vue @@ -3,9 +3,12 @@
Audit Logs
- - +
@@ -28,9 +31,12 @@
- - +
@@ -40,8 +46,12 @@ import { defineComponent } from "vue"; import axios from "./axios"; import { IAuditLogEntry } from "./AuditLog"; +import Pagination from "../../components/Pagination.vue"; export default defineComponent({ + components: { + appPagination: Pagination, + }, data() { return { pageTitle: "Audit Logs" as string, @@ -49,7 +59,7 @@ export default defineComponent({ totalItems: 0 as number, currentPage: 1 as number, pageSize: 5 as number, - errorMessage: "" as string + errorMessage: "" as string, }; }, computed: {}, @@ -60,7 +70,8 @@ export default defineComponent({ this.totalItems = rs.data.totalItems; }); }, - pagedSelected(bvEvent: any, page: number) { + pagedSelected(page: number) { + this.currentPage = page; this.loadAuditLogs(page); }, lowercase: function (value: string) { @@ -70,12 +81,11 @@ export default defineComponent({ if (!value) return value; var date = new Date(value); return date.toLocaleDateString() + " " + date.toLocaleTimeString(); - } + }, }, - components: {}, created() { this.loadAuditLogs(this.currentPage); - } + }, });