Commit 822f4e819209d0a0044fd7f786ab6b0016af3788

Authored by YunaiV
1 parent 4efb6c08

v3.8.2 修复分页组件请求两次问题(I4SQOR)

yudao-ui-admin/src/components/Pagination/index.vue
1 1 <template>
2 2 <div :class="{'hidden':hidden}" class="pagination-container">
3 3 <el-pagination
  4 + v-if="pageShow"
4 5 :background="background"
5 6 :current-page.sync="currentPage"
6 7 :page-size.sync="pageSize"
7 8 :layout="layout"
8 9 :page-sizes="pageSizes"
  10 + :pager-count="pagerCount"
9 11 :total="total"
10 12 v-bind="$attrs"
11 13 @size-change="handleSizeChange"
... ... @@ -60,6 +62,11 @@ export default {
60 62 default: false
61 63 }
62 64 },
  65 + data() {
  66 + return {
  67 + pageShow: true
  68 + };
  69 + },
63 70 computed: {
64 71 currentPage: {
65 72 get() {
... ... @@ -80,6 +87,12 @@ export default {
80 87 },
81 88 methods: {
82 89 handleSizeChange(val) {
  90 + if (this.currentPage * val > this.total) {
  91 + this.pageShow = false;
  92 + this.$nextTick(() => {
  93 + this.pageShow = true
  94 + })
  95 + }
83 96 this.$emit('pagination', { page: this.currentPage, limit: val })
84 97 if (this.autoScroll) {
85 98 scrollTo(0, 800)
... ...