Răsfoiți Sursa

feat(table): pageSize support configuration and header slot can get totalCount

Casper Dai 3 ani în urmă
părinte
comite
cc7379aaa9

+ 5 - 1
src/components/table/GridTable/index.vue

@@ -11,6 +11,7 @@
         <slot
           name="header"
           :condition="options.params"
+          :total-count="options.totalCount"
         />
         <template v-if="buttons">
           <button
@@ -77,6 +78,7 @@
       <grid-table-body
         :data="tableData"
         :item-render="itemRender"
+        v-bind="$attrs"
       />
       <pagination
         :total="options.totalCount"
@@ -101,11 +103,13 @@ export default {
   mixins: [tableMixin],
   data () {
     return {
-      pageSize: 8,
       itemRender: null
     }
   },
   computed: {
+    pageSize () {
+      return this.schema.pageSize || 8
+    },
     isAbnormal () {
       const options = this.options
       return options.error || !options.loading && options.totalCount === 0

+ 4 - 5
src/components/table/Table/index.vue

@@ -12,6 +12,7 @@
         <slot
           name="header"
           :condition="options.params"
+          :total-count="options.totalCount"
         />
         <template v-if="buttons">
           <button
@@ -107,12 +108,10 @@ export default {
     SchemaTableColumn
   },
   mixins: [tableMixin],
-  data () {
-    return {
-      pageSize: 10
-    }
-  },
   computed: {
+    pageSize () {
+      return this.schema.pageSize || 10
+    },
     preventCopy () {
       return !!this.$listeners['row-dblclick']
     },