From 9f9a06ab9347f2547e283863133dc3d113c8a140 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期六, 19 二月 2022 14:23:31 +0800
Subject: [PATCH] 修复分页组件请求两次问题
---
src/components/Pagination/index.vue | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue
index 5b6d718..906f4b0 100644
--- a/src/components/Pagination/index.vue
+++ b/src/components/Pagination/index.vue
@@ -1,9 +1,10 @@
<template>
<div :class="{ 'hidden': hidden }" class="pagination-container">
<el-pagination
+ v-if="pageShow"
:background="background"
v-model:current-page="currentPage"
- :page-size="pageSize"
+ v-model:page-size="pageSize"
:layout="layout"
:page-sizes="pageSizes"
:pager-count="pagerCount"
@@ -16,6 +17,8 @@
<script setup>
import { scrollTo } from '@/utils/scroll-to'
+
+const pageShow = ref(true);
const props = defineProps({
total: {
@@ -77,7 +80,12 @@
}
})
function handleSizeChange(val) {
- pageSize.value = val
+ if (currentPage.value * val > props.total) {
+ pageShow.value = false;
+ nextTick(() => {
+ pageShow.value = true
+ })
+ }
emit('pagination', { page: currentPage.value, limit: val })
if (props.autoScroll) {
scrollTo(0, 800)
--
Gitblit v1.9.3