修复分页组件请求两次问题
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
<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"
|
||||||
@ -17,6 +18,8 @@
|
|||||||
<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,
|
||||||
@ -77,6 +80,12 @@ const pageSize = computed({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
function handleSizeChange(val) {
|
function handleSizeChange(val) {
|
||||||
|
if (currentPage.value * val > props.total) {
|
||||||
|
pageShow.value = false;
|
||||||
|
nextTick(() => {
|
||||||
|
pageShow.value = true
|
||||||
|
})
|
||||||
|
}
|
||||||
emit('pagination', { page: currentPage.value, limit: val })
|
emit('pagination', { page: currentPage.value, limit: val })
|
||||||
if (props.autoScroll) {
|
if (props.autoScroll) {
|
||||||
scrollTo(0, 800)
|
scrollTo(0, 800)
|
||||||
|
@ -373,8 +373,8 @@ function selected(name) {
|
|||||||
}
|
}
|
||||||
/** 关闭弹窗隐藏图标选择 */
|
/** 关闭弹窗隐藏图标选择 */
|
||||||
function handleClose() {
|
function handleClose() {
|
||||||
cancel();
|
cancel();
|
||||||
showChooseIcon.value = false;
|
showChooseIcon.value = false;
|
||||||
}
|
}
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
|
Reference in New Issue
Block a user