-
Notifications
You must be signed in to change notification settings - Fork 37
/
index.html
88 lines (81 loc) · 1.68 KB
/
index.html
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
82
83
84
85
86
87
88
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><%= htmlWebpackPlugin.options.title %></title>
<style>
* {
padding: 0;
margin: 0;
}
html, body {
height: 100%;
display: block;
}
#demo {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="demo"></div>
</body>
<script>
console.time('生成数据消耗');
const bigdata = [];
for (let row = 0; row < 50000; row++) {
const items = [];
for (let col = 0; col < 25; col++) {
items.push(`row-${row}-col-${col}`);
}
bigdata.push(items);
}
console.timeEnd('生成数据消耗');
console.time('表格渲染消耗');
const table = {
name: '5w数据测试',
tableConfig: {
rows: {
len: bigdata.length
},
cols: {
len: 50
},
data: bigdata
},
};
const dome = document.getElementById('demo');
const xsheet = new XSheet(dome, {
workConfig: {
top: {
option: {
show: false,
},
},
body: {
tabConfig: {
showAdd: true,
},
banner: false,
sheets: [table],
},
}
});
console.timeEnd('表格渲染消耗');
// 获取所有的sheet
const sheets = xsheet.getWork()
.getBody()
.getSheets();
// 获取指定的sheet
const sheet = xsheet.getWork()
.getBody()
.getSheetByIndex(0);
const cells = sheet.getTable()
.getTableCells();
const cell = cells.getCell(0, 0);
// 监听输入
XSheet.XEvent.bind(window, XSheet.Constant.TABLE_EVENT_TYPE.EDIT_INPUT, (e) => {
});
</script>
</html>