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,7 +14,7 @@ | ||
| 14 | @mouseleave.native.stop="handleMouseOut(row._index)" | 14 | @mouseleave.native.stop="handleMouseOut(row._index)" |
| 15 | @click.native="clickCurrentRow(row._index)" | 15 | @click.native="clickCurrentRow(row._index)" |
| 16 | @dblclick.native.stop="dblclickCurrentRow(row._index)"> | 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 | <table-cell | 18 | <table-cell |
| 19 | :fixed="fixed" | 19 | :fixed="fixed" |
| 20 | :prefix-cls="prefixCls" | 20 | :prefix-cls="prefixCls" |
| @@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
| 30 | </td> | 30 | </td> |
| 31 | </table-tr> | 31 | </table-tr> |
| 32 | <tr v-if="rowExpanded(row._index)" :class="{[prefixCls + '-expanded-hidden']: fixed}"> | 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 | <Expand :key="rowKey ? row._rowKey : index" :row="row" :render="expandRender" :index="row._index"></Expand> | 34 | <Expand :key="rowKey ? row._rowKey : index" :row="row" :render="expandRender" :index="row._index"></Expand> |
| 35 | </td> | 35 | </td> |
| 36 | </tr> | 36 | </tr> |
| @@ -67,6 +67,12 @@ | @@ -67,6 +67,12 @@ | ||
| 67 | rowKey: { | 67 | rowKey: { |
| 68 | type: Boolean, | 68 | type: Boolean, |
| 69 | default: false | 69 | default: false |
| 70 | + }, | ||
| 71 | + rowExpander: { | ||
| 72 | + type: Function, | ||
| 73 | + default: function(){ | ||
| 74 | + return 1; | ||
| 75 | + } | ||
| 70 | } | 76 | } |
| 71 | }, | 77 | }, |
| 72 | computed: { | 78 | computed: { |
src/components/table/table.vue
| @@ -88,6 +88,7 @@ | @@ -88,6 +88,7 @@ | ||
| 88 | :data="rebuildData" | 88 | :data="rebuildData" |
| 89 | :row-key="rowKey" | 89 | :row-key="rowKey" |
| 90 | :columns-width="columnsWidth" | 90 | :columns-width="columnsWidth" |
| 91 | + :row-expander="rowExpander" | ||
| 91 | :obj-data="objData"></table-body> | 92 | :obj-data="objData"></table-body> |
| 92 | </div> | 93 | </div> |
| 93 | </div> | 94 | </div> |
| @@ -208,6 +209,12 @@ | @@ -208,6 +209,12 @@ | ||
| 208 | rowKey: { | 209 | rowKey: { |
| 209 | type: Boolean, | 210 | type: Boolean, |
| 210 | default: false | 211 | default: false |
| 212 | + }, | ||
| 213 | + rowExpander: { | ||
| 214 | + type: Function, | ||
| 215 | + default: function(){ | ||
| 216 | + return 1; | ||
| 217 | + } | ||
| 211 | } | 218 | } |
| 212 | }, | 219 | }, |
| 213 | data () { | 220 | data () { |