fix pagination

This commit is contained in:
Qiuxia Fan 2022-03-22 19:02:31 +08:00
parent 0b27ff7aa2
commit 10fd4d1d8e
4 changed files with 16 additions and 4 deletions

View File

@ -378,7 +378,10 @@ function searchDashboards(pageIndex?: any) {
const arr = list.filter((d: { name: string }) =>
d.name.includes(searchText.value)
);
dashboards.value = arr.splice(pageIndex || 0, pageSize);
dashboards.value = arr.splice(
(pageIndex - 1 || 0) * pageSize,
pageSize * (pageIndex || 1)
);
}
function reloadTemplates() {

View File

@ -174,7 +174,10 @@ function clickEndpoint(scope: any) {
);
}
function changePage(pageIndex: number) {
endpoints.value = searchEndpoints.value.splice(pageIndex - 1, pageSize);
endpoints.value = searchEndpoints.value.splice(
(pageIndex - 1 || 0) * pageSize,
pageSize * (pageIndex || 1)
);
}
function searchList() {
const currentEndpoints = selectorStore.pods.filter((d: { label: string }) =>

View File

@ -180,7 +180,10 @@ function clickInstance(scope: any) {
}
function changePage(pageIndex: number) {
instances.value = searchInstances.value.splice(pageIndex - 1, pageSize);
instances.value = searchInstances.value.splice(
(pageIndex - 1 || 0) * pageSize,
pageSize * (pageIndex || 1)
);
}
function searchList() {

View File

@ -226,7 +226,10 @@ function objectSpanMethod(param: any): any {
}
}
function changePage(pageIndex: number) {
services.value = selectorStore.services.splice(pageIndex - 1, pageSize);
services.value = services.value.splice(
(pageIndex - 1 || 0) * pageSize,
pageSize * (pageIndex || 1)
);
}
function searchList() {
searchServices.value = selectorStore.services.filter((d: { label: string }) =>