2cb8a6d9
梁灏
commit Table comp...
|
1
|
<template>
|
7f34c510
梁灏
update Table
|
2
3
4
5
6
7
|
<table cellspacing="0" cellpadding="0" border="0" :style="style">
<colgroup>
<col v-for="column in columns" :width="setCellWidth(column, $index)">
</colgroup>
<tbody :class="[prefixCls + '-tbody']">
<tr
|
741b987a
梁灏
update Table
|
8
|
v-for="(index, row) in data"
|
d3dfdb26
梁灏
update Table
|
9
10
11
12
|
:class="rowClasses(row._index)"
@mouseenter.stop="handleMouseIn(row._index)"
@mouseleave.stop="handleMouseOut(row._index)"
@click.stop="highlightCurrentRow(row._index)">
|
7f34c510
梁灏
update Table
|
13
14
15
16
17
18
|
<td v-for="column in columns" :class="alignCls(column)">
<Cell
:fixed="fixed"
:prefix-cls="prefixCls"
:row="row"
:column="column"
|
741b987a
梁灏
update Table
|
19
20
|
:natural-index="index"
:index="row._index"
|
d3dfdb26
梁灏
update Table
|
21
|
:checked="rowChecked(row._index)"></Cell>
|
7f34c510
梁灏
update Table
|
22
23
24
|
</td>
</tr>
</tbody>
|
3ef4dfb9
梁灏
update Table
|
25
|
</table>
|
2cb8a6d9
梁灏
commit Table comp...
|
26
27
|
</template>
<script>
|
7f34c510
梁灏
update Table
|
28
29
30
|
import Cell from './cell.vue';
import Mixin from './mixin';
|
2cb8a6d9
梁灏
commit Table comp...
|
31
|
export default {
|
7f34c510
梁灏
update Table
|
32
33
|
mixins: [ Mixin ],
components: { Cell },
|
2cb8a6d9
梁灏
commit Table comp...
|
34
|
props: {
|
7f34c510
梁灏
update Table
|
35
36
37
|
prefixCls: String,
style: Object,
columns: Array,
|
741b987a
梁灏
update Table
|
38
|
data: Array, // rebuildData
|
741b987a
梁灏
update Table
|
39
|
objData: Object,
|
7f34c510
梁灏
update Table
|
40
|
fixed: Boolean
|
2cb8a6d9
梁灏
commit Table comp...
|
41
42
|
},
methods: {
|
d3dfdb26
梁灏
update Table
|
43
|
rowClasses (_index) {
|
c6f21c2f
jingsam
fix ie bug
|
44
45
|
return [
`${this.prefixCls}-row`,
|
741b987a
梁灏
update Table
|
46
|
this.rowClsName(_index),
|
c6f21c2f
jingsam
fix ie bug
|
47
|
{
|
d3dfdb26
梁灏
update Table
|
48
49
|
[`${this.prefixCls}-row-highlight`]: this.objData[_index]._isHighlight,
[`${this.prefixCls}-row-hover`]: this.objData[_index]._isHover
|
c6f21c2f
jingsam
fix ie bug
|
50
|
}
|
c6f21c2f
jingsam
fix ie bug
|
51
52
|
]
},
|
d3dfdb26
梁灏
update Table
|
53
|
rowChecked (_index) {
|
741b987a
梁灏
update Table
|
54
55
|
return this.objData[_index]._isChecked;
},
|
7f34c510
梁灏
update Table
|
56
57
58
|
setCellWidth (column, index) {
return this.$parent.setCellWidth(column, index);
},
|
d3dfdb26
梁灏
update Table
|
59
60
|
rowClsName (_index) {
return this.$parent.rowClassName(this.objData[_index], _index);
|
7f34c510
梁灏
update Table
|
61
|
},
|
d3dfdb26
梁灏
update Table
|
62
63
|
handleMouseIn (_index) {
this.$parent.handleMouseIn(_index);
|
7f34c510
梁灏
update Table
|
64
|
},
|
d3dfdb26
梁灏
update Table
|
65
66
|
handleMouseOut (_index) {
this.$parent.handleMouseOut(_index);
|
7f34c510
梁灏
update Table
|
67
|
},
|
d3dfdb26
梁灏
update Table
|
68
69
|
highlightCurrentRow (_index) {
this.$parent.highlightCurrentRow(_index);
|
7f34c510
梁灏
update Table
|
70
|
}
|
2cb8a6d9
梁灏
commit Table comp...
|
71
72
|
}
}
|
c6f21c2f
jingsam
fix ie bug
|
73
|
</script>
|