From e148486f2dd70dd86e05972237b66f587e475665 Mon Sep 17 00:00:00 2001 From: Mehdi104797 <92753457+Mehdi104797@users.noreply.github.com> Date: Sat, 14 Feb 2026 09:29:48 +0330 Subject: [PATCH] =?UTF-8?q?pagination=20=D8=AF=D8=B1=D8=B3=D8=AA=20=DA=A9?= =?UTF-8?q?=D8=B1=D8=AF=D9=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lazy-load/data-entry/MainList.vue | 18 +++++++-------- app/pages/index.vue | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/app/components/lazy-load/data-entry/MainList.vue b/app/components/lazy-load/data-entry/MainList.vue index 78baa4e..bea66f7 100644 --- a/app/components/lazy-load/data-entry/MainList.vue +++ b/app/components/lazy-load/data-entry/MainList.vue @@ -24,24 +24,20 @@ const props = defineProps({ type: Array, default: () => [], }, + pagination: { + type: Object, + default: () => {}, + }, }); const emit = defineEmits(["conflict-details"]); -const pagination = ref({ - total: 0, - page: 1, - limit: 10, -}); + const myContentSchema = computed(() => { const baseSchema = JSON.parse(JSON.stringify(myContentJson)); return { ...baseSchema, items: props.listConflicts?.hits ?? [], - pagination: { - total: props.listConflicts?.total?.value ?? 0, - page: pagination.value.page, - limit: pagination.value.limit, - }, + pagination: props.pagination, }; }); const headerTools = computed(() => [ @@ -81,6 +77,8 @@ function headerToolsAction({ action, data }) { function myContentAction({ action, payload }) { if (action === "conflict_Details") { emit("conflict-details", payload); + } else { + emit("my-content-action", { action, payload }); } } diff --git a/app/pages/index.vue b/app/pages/index.vue index a7455e4..2672dbc 100755 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -15,7 +15,9 @@ :activeTabKey="activeTabKey" :listConflicts="listConflicts" :conflictSelected="conflictSelected" + :pagination="pagination" @conflict-details="conflictDetails" + @my-content-action="myContentAction" /> @@ -131,6 +133,12 @@ const getListConflict = async (textSearch = "", filterExtended = "") => { console.log("res", res); listConflicts.value = res.hits; + pagination.value.total = res.hits.total.value; + // reactiveSampleData.value.pagination = { + // total: res.hits.total.value, + // page: pagination.value.page, + // limit: pagination.value.limit, + // }; } catch (err) { console.error("خطا در دریافت داده:", err); } @@ -144,4 +152,18 @@ onMounted(() => { getListConflict(); activeTabKey.value = headerTabs.value[0]?.id || ""; }); + +function myContentAction({ action, payload }) { + console.log("payload ==> ", payload); + console.log("action ==> ", action); + if (action === "pagination") { + const { page, limit } = payload; + pagination.value.page = page; + pagination.value.limit = limit; + console.log("pagination.value ==> ", pagination.value); + + getListConflict(); + return; + } +}