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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _index = require('../index');
var _index2 = _interopRequireDefault(_index);
require('../assets/index.less');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/* eslint-disable no-console,func-names,react/no-multi-comp */
var data = [];
for (var i = 0; i < 10; i++) {
data.push({
key: i,
a: 'a' + i,
b: 'b' + i,
c: 'c' + i
});
}
exports['default'] = {
data: function data() {
return {
showBody: true
};
},
methods: {
toggleBody: function toggleBody() {
this.showBody = !this.showBody;
}
},
render: function render() {
var h = arguments[0];
var columns = [{ title: 'title1', key: 'a', dataIndex: 'a', width: 100 }, { id: '123', title: 'title2', dataIndex: 'b', key: 'b', width: 100 }, { title: 'title3', key: 'c', dataIndex: 'c', width: 200 }, {
title: h(
'a',
{
on: {
'click': this.toggleBody
},
attrs: { href: 'javascript:;' }
},
[this.showBody ? '隐藏' : '显示', '\u4F53']
),
key: 'x',
width: 200,
customRender: function customRender() {
var h = this.$createElement;
return h(
'a',
{
attrs: { href: '#' }
},
['Operations']
);
}
}];
return h('div', [h('h2', ['scroll body table']), h(_index2['default'], {
attrs: {
columns: columns,
data: data,
scroll: { y: 300 },
rowKey: function rowKey(record) {
return record.key;
},
bodyStyle: {
display: this.showBody ? '' : 'none'
}
}
})]);
}
};