Kaynağa Gözat

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

RuoYi 4 yıl önce
ebeveyn
işleme
642cfbda0a
1 değiştirilmiş dosya ile 12 ekleme ve 0 silme
  1. 12 0
      ruoyi-ui/src/components/Pagination/index.vue

+ 12 - 0
ruoyi-ui/src/components/Pagination/index.vue

@@ -1,6 +1,7 @@
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"
@@ -61,6 +62,11 @@ export default {
61 62
       default: false
62 63
     }
63 64
   },
65
+  data() {
66
+    return {
67
+      pageShow: true
68
+    };
69
+  },
64 70
   computed: {
65 71
     currentPage: {
66 72
       get() {
@@ -81,6 +87,12 @@ export default {
81 87
   },
82 88
   methods: {
83 89
     handleSizeChange(val) {
90
+      if (this.currentPage * val > this.total) {
91
+        this.pageShow = false;
92
+        this.$nextTick(() => {
93
+          this.pageShow = true
94
+        })
95
+      }
84 96
       this.$emit('pagination', { page: this.currentPage, limit: val })
85 97
       if (this.autoScroll) {
86 98
         scrollTo(0, 800)