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 |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue
index cdd3c3e..906f4b0 100644
--- a/src/components/Pagination/index.vue
+++ b/src/components/Pagination/index.vue
@@ -1,6 +1,7 @@
 <template>
   <div :class="{ 'hidden': hidden }" class="pagination-container">
     <el-pagination
+      v-if="pageShow"
       :background="background"
       v-model:current-page="currentPage"
       v-model:page-size="pageSize"
@@ -16,6 +17,8 @@
 
 <script setup>
 import { scrollTo } from '@/utils/scroll-to'
+
+const pageShow = ref(true);
 
 const props = defineProps({
   total: {
@@ -77,6 +80,12 @@
   }
 })
 function handleSizeChange(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