pagination درست کردن
This commit is contained in:
parent
f88deee0c3
commit
e148486f2d
|
|
@ -24,24 +24,20 @@ const props = defineProps({
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
pagination: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const emit = defineEmits(["conflict-details"]);
|
const emit = defineEmits(["conflict-details"]);
|
||||||
const pagination = ref({
|
|
||||||
total: 0,
|
|
||||||
page: 1,
|
|
||||||
limit: 10,
|
|
||||||
});
|
|
||||||
const myContentSchema = computed(() => {
|
const myContentSchema = computed(() => {
|
||||||
const baseSchema = JSON.parse(JSON.stringify(myContentJson));
|
const baseSchema = JSON.parse(JSON.stringify(myContentJson));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...baseSchema,
|
...baseSchema,
|
||||||
items: props.listConflicts?.hits ?? [],
|
items: props.listConflicts?.hits ?? [],
|
||||||
pagination: {
|
pagination: props.pagination,
|
||||||
total: props.listConflicts?.total?.value ?? 0,
|
|
||||||
page: pagination.value.page,
|
|
||||||
limit: pagination.value.limit,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const headerTools = computed(() => [
|
const headerTools = computed(() => [
|
||||||
|
|
@ -81,6 +77,8 @@ function headerToolsAction({ action, data }) {
|
||||||
function myContentAction({ action, payload }) {
|
function myContentAction({ action, payload }) {
|
||||||
if (action === "conflict_Details") {
|
if (action === "conflict_Details") {
|
||||||
emit("conflict-details", payload);
|
emit("conflict-details", payload);
|
||||||
|
} else {
|
||||||
|
emit("my-content-action", { action, payload });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@
|
||||||
:activeTabKey="activeTabKey"
|
:activeTabKey="activeTabKey"
|
||||||
:listConflicts="listConflicts"
|
:listConflicts="listConflicts"
|
||||||
:conflictSelected="conflictSelected"
|
:conflictSelected="conflictSelected"
|
||||||
|
:pagination="pagination"
|
||||||
@conflict-details="conflictDetails"
|
@conflict-details="conflictDetails"
|
||||||
|
@my-content-action="myContentAction"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -131,6 +133,12 @@ const getListConflict = async (textSearch = "", filterExtended = "") => {
|
||||||
console.log("res", res);
|
console.log("res", res);
|
||||||
|
|
||||||
listConflicts.value = res.hits;
|
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) {
|
} catch (err) {
|
||||||
console.error("خطا در دریافت داده:", err);
|
console.error("خطا در دریافت داده:", err);
|
||||||
}
|
}
|
||||||
|
|
@ -144,4 +152,18 @@ onMounted(() => {
|
||||||
getListConflict();
|
getListConflict();
|
||||||
activeTabKey.value = headerTabs.value[0]?.id || "";
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user