修复分页组件请求两次问题

master
RuoYi 3 years ago
parent 8c94c48ab5
commit 0587b81abd
  1. 8
      src/components/Pagination/index.vue

@ -1,7 +1,6 @@
<template> <template>
<div :class="{ 'hidden': hidden }" class="pagination-container"> <div :class="{ 'hidden': hidden }" class="pagination-container">
<el-pagination <el-pagination
v-if="pageShow"
:background="background" :background="background"
v-model:current-page="currentPage" v-model:current-page="currentPage"
v-model:page-size="pageSize" v-model:page-size="pageSize"
@ -18,8 +17,6 @@
<script setup> <script setup>
import { scrollTo } from '@/utils/scroll-to' import { scrollTo } from '@/utils/scroll-to'
const pageShow = ref(true);
const props = defineProps({ const props = defineProps({
total: { total: {
required: true, required: true,
@ -81,10 +78,7 @@ const pageSize = computed({
}) })
function handleSizeChange(val) { function handleSizeChange(val) {
if (currentPage.value * val > props.total) { if (currentPage.value * val > props.total) {
pageShow.value = false; currentPage.value = 1
nextTick(() => {
pageShow.value = true
})
} }
emit('pagination', { page: currentPage.value, limit: val }) emit('pagination', { page: currentPage.value, limit: val })
if (props.autoScroll) { if (props.autoScroll) {

Loading…
Cancel
Save