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