แก้ pagination ของ TableHistory
This commit is contained in:
parent
a5564cf99a
commit
19c2a8b2b0
1 changed files with 26 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<q-dialog :model-value="modal" persistent>
|
<q-dialog :model-value="modal" persistent>
|
||||||
<q-card style="min-width: 70vw;">
|
<q-card style="min-width: 70vw">
|
||||||
<q-form ref="myForm">
|
<q-form ref="myForm">
|
||||||
<div class="row items-center q-pa-sm">
|
<div class="row items-center q-pa-sm">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -89,8 +89,7 @@
|
||||||
:virtual-scroll-sticky-size-start="48"
|
:virtual-scroll-sticky-size-start="48"
|
||||||
dense
|
dense
|
||||||
:pagination-label="paginationLabel"
|
:pagination-label="paginationLabel"
|
||||||
:pagination="initialPagination"
|
v-model:pagination="pagination"
|
||||||
:rows-per-page-options="[0]"
|
|
||||||
>
|
>
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
|
@ -104,6 +103,17 @@
|
||||||
<template #body="props">
|
<template #body="props">
|
||||||
<slot v-bind="props" name="columns"></slot>
|
<slot v-bind="props" name="columns"></slot>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-slot:pagination="scope">
|
||||||
|
<q-pagination
|
||||||
|
v-model="pagination.page"
|
||||||
|
color="grey-8"
|
||||||
|
:max="scope.pagesNumber"
|
||||||
|
:max-pages="5"
|
||||||
|
size="sm"
|
||||||
|
boundary-links
|
||||||
|
direction-links
|
||||||
|
></q-pagination>
|
||||||
|
</template>
|
||||||
</q-table>
|
</q-table>
|
||||||
</div>
|
</div>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
@ -112,9 +122,10 @@
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, useAttrs } from "vue";
|
import { ref, useAttrs, computed } from "vue";
|
||||||
import type { Pagination } from "@/modules/01_metadata/interface/index/Main";
|
import type { Pagination } from "@/modules/01_metadata/interface/index/Main";
|
||||||
|
|
||||||
|
const rows = ref<any>([]);
|
||||||
const attrs = ref<any>(useAttrs());
|
const attrs = ref<any>(useAttrs());
|
||||||
const filterRef = ref<any>(null);
|
const filterRef = ref<any>(null);
|
||||||
// const history = ref<string>("");
|
// const history = ref<string>("");
|
||||||
|
|
@ -123,6 +134,17 @@ const initialPagination = ref<Pagination>({
|
||||||
rowsPerPage: 0,
|
rowsPerPage: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pagination = ref({
|
||||||
|
sortBy: "desc",
|
||||||
|
descending: false,
|
||||||
|
page: 1,
|
||||||
|
rowsPerPage: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
const pagesNumber = computed(() => {
|
||||||
|
return Math.ceil(rows.value.length / pagination.value.rowsPerPage);
|
||||||
|
});
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
tittle: String,
|
tittle: String,
|
||||||
inputfilter: String,
|
inputfilter: String,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue