Jelajahi Sumber

update pagination

Leopoldthecoder 9 tahun lalu
induk
melakukan
3b0477b90f
3 mengubah file dengan 3 tambahan dan 5 penghapusan
  1. 1 0
      CHANGELOG.md
  2. 1 4
      examples/docs/pagination.md
  3. 1 1
      packages/pagination/src/pagination.js

+ 1 - 0
CHANGELOG.md

@@ -15,6 +15,7 @@
 - 修复 Select 选中 value 为 0 的值时绑定值不更新的问题
 - 修复 Tree 取消选择某节点后,其同级节点均被取消的问题
 - 修复 Upload 的 headers 属性设置无效
+- 修复 Pagination 包含 sizes 子组件时 page-size 无效的问题
 - 优化 增加打包成 commonjs 且不压缩的文件,默认引入 commonjs
 
 #### 非兼容性更新

+ 1 - 4
examples/docs/pagination.md

@@ -52,7 +52,6 @@
       @sizechange="handleSizeChange"
       @currentchange="handleCurrentChange"
       :current-page="5"
-      :page-sizes="[100, 200, 300, 400]"
       :page-size="100"
       layout="total, prev, pager, next"
       :total="1000">
@@ -76,7 +75,6 @@
       @sizechange="handleSizeChange"
       @currentchange="handleCurrentChange"
       :current-page="5"
-      :page-sizes="[100, 200, 300, 400]"
       :page-size="100"
       layout="prev, pager, next, jumper"
       :total="1000">
@@ -160,7 +158,6 @@
 
   .demo-pagination .last .block {
     padding: 30px 24px;
-    overflow: hidden;
     border-bottom: solid 1px #EFF2F6;
     &:last-child {
       border-bottom: none;      
@@ -188,7 +185,7 @@
 | page-size              | 每页显示条目个数                                                   | Number |      —       | 10 |
 | total | 总条目数 | Number | — | 0 |
 | current-page | 当前页数 | Number | — | 0|
-| layout | 组件布局,子组件名用逗号分隔。| String | `size`, `prev`, `pager`, `next`, `jumper`, `->`, `total` | 'prev, pager, next, jumper, ->, total'  |
+| layout | 组件布局,子组件名用逗号分隔。| String | `sizes`, `prev`, `pager`, `next`, `jumper`, `->`, `total` | 'prev, pager, next, jumper, ->, total'  |
 | page-sizes | 每页显示个数选择器的选项设置 | Number[] | — |  [10, 20, 30, 40, 50, 100] |
 
 ### Events

+ 1 - 1
packages/pagination/src/pagination.js

@@ -116,7 +116,7 @@ export default {
     Sizes: {
       created() {
         if (Array.isArray(this.$parent.pageSizes)) {
-          this.$parent.internalPageSize = this.$parent.pageSizes[0];
+          this.$parent.internalPageSize = this.$parent.pageSizes.indexOf(this.$parent.pageSize) > -1 ? this.$parent.pageSize : this.$parent.pageSizes[0];
         }
       },