-
Notifications
You must be signed in to change notification settings - Fork 795
/
Copy pathsummary.vue
51 lines (50 loc) · 1.79 KB
/
summary.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<template>
<div style="overflow:hidden;">
<table class="ivu-table-summary" cellspacing="0" cellpadding="0" border="0" :style="styleObject">
<colgroup>
<col v-for="(column, index) in columns" :width="setCellWidth(column)">
</colgroup>
<tbody :class="[prefixCls + '-tbody']">
<tr class="ivu-table-row">
<td v-for="(column, index) in columns" :class="alignCls(column)">
<div class="ivu-table-cell" :class="cellCls(column)">
<span v-if="!data[column.key].render">{{ data[column.key].value }}</span>
<render-cell v-else :render="data[column.key].render"></render-cell>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</template>
<script>
import Mixin from './mixin';
import RenderCell from '../base/render';
export default {
name: 'TableSummary',
components:{
RenderCell
},
mixins: [ Mixin ],
props: {
prefixCls: String,
styleObject: Object,
columns: Array,
data: Object, // rebuildData
columnsWidth: Object,
fixed: {
type: [Boolean, String],
default: false
},
},
methods: {
cellCls (column) {
return [
{
['ivu-table-hidden']: (this.fixed === 'left' && column.fixed !== 'left') || (this.fixed === 'right' && column.fixed !== 'right') || (!this.fixed && column.fixed && (column.fixed === 'left' || column.fixed === 'right'))
}
];
}
}
};
</script>