Table: add empty slot, closed #1737, closed #1730

pull/1740/head
qingwei.li 2016-12-14 11:57:25 +08:00 committed by 杨奕
parent 0ee61e7296
commit 3bf624c757
3 changed files with 6 additions and 4 deletions

View File

@ -188,7 +188,7 @@
}
return '';
},
deleteRow(index, rows) {
rows.splice(index, 1);
}
@ -1362,6 +1362,7 @@ Customize table column so it can be integrated with other components.
| row-style | function that returns custom style for a row, or a string assigning custom style for every row | Function(row, index)/Object | — | — |
| row-key | key of row data, used for optimizing rendering. Required if `reserve-selection` is on | Function(row)/String | — | — |
| context | context of Table, e.g. `_self` refers to the current context, `$parent` parent context, `$root` root context, can be overridden by `context` in `el-table-column` | Object | - | current context where Table lies |
| empty-text | Displayed text when data is empty. You can customize this area with `slot="empty"` | String | | - | No Data |
### Table Events
| Event Name | Description | Parameters |

View File

@ -164,7 +164,7 @@
.el-table .positive-row {
background: #e2f0e4;
}
.demo-table .name-wrapper {
display: inline-block;
}
@ -1196,6 +1196,7 @@
| row-style | 行的 style 的回调方法,也可以使用一个固定的 Object 为所有行设置一样的 Style。 | Function(row, index)/Object | — | — |
| row-key | 行数据的 Key用来优化 Table 的渲染;在使用 reserve-selection 功能的情况下,该属性是必填的 | Function(row)/String | — | — |
| context | 设置上下文环境,例如设置当前上下文就是 `_self`,父级就是 `$parent`,根组件 `$root`。优先读取 column 的 context 属性。 | Object | - | Table 所处上下文 |
| empty-text | 空数据时显示的文本内容,也可以通过 `slot="empty"` 设置 | String | | - | 暂无数据 |
### Table Events
| 事件名 | 说明 | 参数 |

View File

@ -29,7 +29,7 @@
:style="{ width: layout.bodyWidth ? layout.bodyWidth - (layout.scrollY ? layout.gutterWidth : 0 ) + 'px' : '' }">
</table-body>
<div class="el-table__empty-block" v-if="!data || data.length === 0">
<span class="el-table__empty-text">{{ emptyText || t('el.table.emptyText') }}</span>
<span class="el-table__empty-text"><slot name="empty">{{ emptyText || t('el.table.emptyText') }}</slot></span>
</div>
</div>
<div class="el-table__fixed" ref="fixedWrapper"
@ -93,7 +93,7 @@
</table-body>
</div>
</div>
<div class="el-table__fixed-right-patch"
<div class="el-table__fixed-right-patch"
v-if="rightFixedColumns.length > 0"
:style="{ width: layout.scrollY ? layout.gutterWidth + 'px' : '0', height: layout.headerHeight + 'px' }"></div>
<div class="el-table__column-resize-proxy" ref="resizeProxy" v-show="resizeProxyVisible"></div>