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/views/system/menu/index.vue | 4 ++--
src/components/Pagination/index.vue | 9 +++++++++
2 files changed, 11 insertions(+), 2 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)
diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue
index c221f4e..a9caba3 100644
--- a/src/views/system/menu/index.vue
+++ b/src/views/system/menu/index.vue
@@ -373,8 +373,8 @@
}
/** 鍏抽棴寮圭獥闅愯棌鍥炬爣閫夋嫨 */
function handleClose() {
- cancel();
- showChooseIcon.value = false;
+ cancel();
+ showChooseIcon.value = false;
}
/** 鎼滅储鎸夐挳鎿嶄綔 */
function handleQuery() {
--
Gitblit v1.9.3