update Table
update Table
This commit is contained in:
parent
52874e27e5
commit
741b987a33
6 changed files with 100 additions and 38 deletions
|
@ -5,8 +5,8 @@
|
|||
</colgroup>
|
||||
<tbody :class="[prefixCls + '-tbody']">
|
||||
<tr
|
||||
v-for="(index, row) in cloneData"
|
||||
:class="rowClasses(row, index)"
|
||||
v-for="(index, row) in data"
|
||||
:class="rowClasses(index, row._index)"
|
||||
@mouseenter.stop="handleMouseIn(index)"
|
||||
@mouseleave.stop="handleMouseOut(index)"
|
||||
@click.stop="highlightCurrentRow(index)">
|
||||
|
@ -16,8 +16,9 @@
|
|||
:prefix-cls="prefixCls"
|
||||
:row="row"
|
||||
:column="column"
|
||||
:index="index"
|
||||
:checked="cloneData[index] && cloneData[index]._isChecked"></Cell>
|
||||
:natural-index="index"
|
||||
:index="row._index"
|
||||
:checked="rowChecked(index, row._index)"></Cell>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -34,20 +35,27 @@
|
|||
prefixCls: String,
|
||||
style: Object,
|
||||
columns: Array,
|
||||
data: Array, // rebuildData
|
||||
cloneData: Array,
|
||||
objData: Object,
|
||||
fixed: Boolean
|
||||
},
|
||||
methods: {
|
||||
rowClasses (row, index) {
|
||||
rowClasses (index, _index) {
|
||||
return [
|
||||
`${this.prefixCls}-row`,
|
||||
this.rowClsName(index),
|
||||
this.rowClsName(_index),
|
||||
{
|
||||
[`${this.prefixCls}-row-highlight`]: this.cloneData[index] && this.cloneData[index]._isHighlight,
|
||||
[`${this.prefixCls}-row-hover`]: this.cloneData[index] && this.cloneData[index]._isHover
|
||||
}
|
||||
]
|
||||
},
|
||||
rowChecked (index, _index) {
|
||||
// const data = this.cloneData.filter(row => row._index === _index);
|
||||
// return data && data._isChecked;
|
||||
return this.objData[_index]._isChecked;
|
||||
},
|
||||
setCellWidth (column, index) {
|
||||
return this.$parent.setCellWidth(column, index);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue