Commit ccfe47149ce68d22d576a1c3c7d0a7ad782c1cd5
1 parent
4fbb5ef3
更新
Showing
3 changed files
with
16 additions
and
2 deletions
Show diff stats
.gitignore
src/components/table/table-body.vue
| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | @mouseleave.native.stop="handleMouseOut(row._index)" |
| 15 | 15 | @click.native="clickCurrentRow(row._index)" |
| 16 | 16 | @dblclick.native.stop="dblclickCurrentRow(row._index)"> |
| 17 | - <td v-for="column in columns" :class="alignCls(column, row)"> | |
| 17 | + <td v-for="column in columns" :rowspan="rowExpander(row, column)" :class="alignCls(column, row)"> | |
| 18 | 18 | <table-cell |
| 19 | 19 | :fixed="fixed" |
| 20 | 20 | :prefix-cls="prefixCls" |
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | </td> |
| 31 | 31 | </table-tr> |
| 32 | 32 | <tr v-if="rowExpanded(row._index)" :class="{[prefixCls + '-expanded-hidden']: fixed}"> |
| 33 | - <td :colspan="columns.length" :class="prefixCls + '-expanded-cell'"> | |
| 33 | + <td :colspan="columns.length" :class="prefixCls + '-expanded-cell'"> | |
| 34 | 34 | <Expand :key="rowKey ? row._rowKey : index" :row="row" :render="expandRender" :index="row._index"></Expand> |
| 35 | 35 | </td> |
| 36 | 36 | </tr> |
| ... | ... | @@ -67,6 +67,12 @@ |
| 67 | 67 | rowKey: { |
| 68 | 68 | type: Boolean, |
| 69 | 69 | default: false |
| 70 | + }, | |
| 71 | + rowExpander: { | |
| 72 | + type: Function, | |
| 73 | + default: function(){ | |
| 74 | + return 1; | |
| 75 | + } | |
| 70 | 76 | } |
| 71 | 77 | }, |
| 72 | 78 | computed: { | ... | ... |
src/components/table/table.vue
| ... | ... | @@ -88,6 +88,7 @@ |
| 88 | 88 | :data="rebuildData" |
| 89 | 89 | :row-key="rowKey" |
| 90 | 90 | :columns-width="columnsWidth" |
| 91 | + :row-expander="rowExpander" | |
| 91 | 92 | :obj-data="objData"></table-body> |
| 92 | 93 | </div> |
| 93 | 94 | </div> |
| ... | ... | @@ -208,6 +209,12 @@ |
| 208 | 209 | rowKey: { |
| 209 | 210 | type: Boolean, |
| 210 | 211 | default: false |
| 212 | + }, | |
| 213 | + rowExpander: { | |
| 214 | + type: Function, | |
| 215 | + default: function(){ | |
| 216 | + return 1; | |
| 217 | + } | |
| 211 | 218 | } |
| 212 | 219 | }, |
| 213 | 220 | data () { | ... | ... |