浏览代码

完善s-table expand事件

zzzz 5 年之前
父节点
当前提交
53192b91e2
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/components/Table/index.js

+ 5 - 1
src/components/Table/index.js

@@ -23,6 +23,10 @@ export default {
       type: Function,
       required: true
     },
+    onExpand: {
+      type: Function,
+      required: false
+    },
     pageNum: {
       type: Number,
       default: 1
@@ -301,7 +305,7 @@ export default {
       return props[k]
     })
     const table = (
-      <a-table {...{ props, scopedSlots: { ...this.$scopedSlots } }} onChange={this.loadData}>
+      <a-table {...{ props, scopedSlots: { ...this.$scopedSlots } }} onChange={this.loadData} onExpand={ (expanded, record) => { this.onExpand && this.onExpand(expanded, record) } }>
         { Object.keys(this.$slots).map(name => (<template slot={name}>{this.$slots[name]}</template>)) }
       </a-table>
     )