mirror of https://github.com/ElemeFE/element
commit
073b791519
|
@ -76,7 +76,8 @@
|
||||||
address: '上海市普陀区金沙江路 1518 弄'
|
address: '上海市普陀区金沙江路 1518 弄'
|
||||||
}],
|
}],
|
||||||
singleSelection: {},
|
singleSelection: {},
|
||||||
multipleSelection: []
|
multipleSelection: [],
|
||||||
|
model: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -676,4 +676,5 @@ Table 组件中,只要在列中设置`sortable`属性即可实现以该列为
|
||||||
| type | 对应列的类型。如果设置了 `selection` 则显示多选按钮,如果设置了 `index` 则显示该行的索引(从 1 开始计算) | string | 'selection', 'index' | 0 |
|
| type | 对应列的类型。如果设置了 `selection` 则显示多选按钮,如果设置了 `index` 则显示该行的索引(从 1 开始计算) | string | 'selection', 'index' | 0 |
|
||||||
| formatter | 用来格式化内容,在 formatter 执行的时候,会传入 row 和 column | function | | |
|
| formatter | 用来格式化内容,在 formatter 执行的时候,会传入 row 和 column | function | | |
|
||||||
| show-tooltip-when-overflow | 当过长被隐藏时显示 tooltip | Boolean | | false |
|
| show-tooltip-when-overflow | 当过长被隐藏时显示 tooltip | Boolean | | false |
|
||||||
| inline-template | 指定该属性后可以自定义 column 模板,参考多选的时间列,通过 row 获取行信息。此时不需要配置 property 属性 | | |
|
| inline-template | 指定该属性后可以自定义 column 模板,参考多选的时间列,通过 row 获取行信息,通过 _self 获取当前上下文。此时不需要配置 property 属性 | | |
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ export default {
|
||||||
on-click={ ($event) => this.handleClick($event, row) }
|
on-click={ ($event) => this.handleClick($event, row) }
|
||||||
on-mouseenter={ _ => this.handleMouseEnter($index) }
|
on-mouseenter={ _ => this.handleMouseEnter($index) }
|
||||||
class={{
|
class={{
|
||||||
'current-row': row === this.$parent.$parent.selected,
|
'current-row': row === this.$parent.selected,
|
||||||
'hover': this.$parent.$parent.hoverRowIndex === $index,
|
'hover': this.$parent.$parent.hoverRowIndex === $index,
|
||||||
'positive-row': row.$positive,
|
'positive-row': row.$positive,
|
||||||
'info-row': row.$info,
|
'info-row': row.$info,
|
||||||
|
@ -59,7 +59,7 @@ export default {
|
||||||
on-mouseleave={ this.handleCellMouseLeave }>
|
on-mouseleave={ this.handleCellMouseLeave }>
|
||||||
{
|
{
|
||||||
column.template
|
column.template
|
||||||
? column.template.call(this._renderProxy, h, { row, column, $index })
|
? column.template.call(this._renderProxy, h, { row, column, $index, _self: this.$parent.$parent })
|
||||||
: <div class="cell">{ this.$getPropertyText(row, column.property, column.id) }</div>
|
: <div class="cell">{ this.$getPropertyText(row, column.property, column.id) }</div>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
|
@ -131,7 +131,6 @@ export default {
|
||||||
|
|
||||||
if (grid.selectionMode === 'single') {
|
if (grid.selectionMode === 'single') {
|
||||||
grid.selected = row;
|
grid.selected = row;
|
||||||
grid.$emit('selectionchange', row);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grid.$emit('rowclick', row, event);
|
grid.$emit('rowclick', row, event);
|
||||||
|
|
|
@ -251,8 +251,9 @@
|
||||||
gridWrapper.style.height = bodyHeight + 'px';
|
gridWrapper.style.height = bodyHeight + 'px';
|
||||||
|
|
||||||
this.$el.style.height = height + 'px';
|
this.$el.style.height = height + 'px';
|
||||||
|
if (this.$refs.fixed) {
|
||||||
this.$refs.fixed.style.height = height + 'px';
|
this.$refs.fixed.style.height = height + 'px';
|
||||||
|
}
|
||||||
const fixedBodyWrapper = this.$el.querySelector('.el-table__fixed-body-wrapper');
|
const fixedBodyWrapper = this.$el.querySelector('.el-table__fixed-body-wrapper');
|
||||||
if (fixedBodyWrapper) {
|
if (fixedBodyWrapper) {
|
||||||
fixedBodyWrapper.style.height = (this.showHScrollBar ? gridWrapper.offsetHeight - this.currentGutterWidth : gridWrapper.offsetHeight) + 'px';
|
fixedBodyWrapper.style.height = (this.showHScrollBar ? gridWrapper.offsetHeight - this.currentGutterWidth : gridWrapper.offsetHeight) + 'px';
|
||||||
|
@ -312,7 +313,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.tableData = this.data;
|
|
||||||
this.gridId = 'grid_' + gridIdSeed + '_';
|
this.gridId = 'grid_' + gridIdSeed + '_';
|
||||||
|
|
||||||
if (GUTTER_WIDTH === undefined) {
|
if (GUTTER_WIDTH === undefined) {
|
||||||
|
@ -370,6 +370,14 @@
|
||||||
this.$calcHeight(value);
|
this.$calcHeight(value);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
data(val) {
|
||||||
|
if (val && this.selectionMode === 'multiple') {
|
||||||
|
this.tableData = val.map(item => objectAssign({ '$selected': false }, item));
|
||||||
|
} else {
|
||||||
|
this.tableData = val;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
tableData(newVal) {
|
tableData(newVal) {
|
||||||
this.doOnDataChange(newVal);
|
this.doOnDataChange(newVal);
|
||||||
this.updateScrollInfo();
|
this.updateScrollInfo();
|
||||||
|
@ -395,10 +403,6 @@
|
||||||
|
|
||||||
this.styleNode = styleNode;
|
this.styleNode = styleNode;
|
||||||
|
|
||||||
if (this.tableData && this.selectionMode === 'multiple') {
|
|
||||||
this.tableData = this.tableData.map(item => objectAssign({ '$selected': false }, item));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.doRender();
|
this.doRender();
|
||||||
|
|
||||||
this.$ready = true;
|
this.$ready = true;
|
||||||
|
@ -408,14 +412,16 @@
|
||||||
this.updateScrollInfo();
|
this.updateScrollInfo();
|
||||||
if (this.fixedColumnCount > 0) {
|
if (this.fixedColumnCount > 0) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.fixed.style.height = this.$el.clientHeight + 'px';
|
const style = this.$refs.fixed.style;
|
||||||
|
if (!style) return;
|
||||||
|
style.height = this.$el.clientHeight + 'px';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableData: [],
|
tableData: this.data,
|
||||||
showHScrollBar: false,
|
showHScrollBar: false,
|
||||||
showVScrollBar: false,
|
showVScrollBar: false,
|
||||||
hoverRowIndex: null,
|
hoverRowIndex: null,
|
||||||
|
|
Loading…
Reference in New Issue