Browse Source

优化分页组件发送两次请求的实现

East 4 years ago
parent
commit
1358b21c3a
1 changed files with 1 additions and 6 deletions
  1. 1 6
      ruoyi-ui/src/components/Pagination/index.vue

+ 1 - 6
ruoyi-ui/src/components/Pagination/index.vue

@@ -1,7 +1,6 @@
1
 <template>
1
 <template>
2
   <div :class="{'hidden':hidden}" class="pagination-container">
2
   <div :class="{'hidden':hidden}" class="pagination-container">
3
     <el-pagination
3
     <el-pagination
4
-      v-if="pageShow"
5
       :background="background"
4
       :background="background"
6
       :current-page.sync="currentPage"
5
       :current-page.sync="currentPage"
7
       :page-size.sync="pageSize"
6
       :page-size.sync="pageSize"
@@ -64,7 +63,6 @@ export default {
64
   },
63
   },
65
   data() {
64
   data() {
66
     return {
65
     return {
67
-      pageShow: true
68
     };
66
     };
69
   },
67
   },
70
   computed: {
68
   computed: {
@@ -88,10 +86,7 @@ export default {
88
   methods: {
86
   methods: {
89
     handleSizeChange(val) {
87
     handleSizeChange(val) {
90
       if (this.currentPage * val > this.total) {
88
       if (this.currentPage * val > this.total) {
91
-        this.pageShow = false;
92
-        this.$nextTick(() => {
93
-          this.pageShow = true
94
-        })
89
+        this.currentPage = 1
95
       }
90
       }
96
       this.$emit('pagination', { page: this.currentPage, limit: val })
91
       this.$emit('pagination', { page: this.currentPage, limit: val })
97
       if (this.autoScroll) {
92
       if (this.autoScroll) {