Skip to content

Commit 2d45ccf

Browse files
committed
progress
1 parent df97a14 commit 2d45ccf

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

frameworks/keyed/doz/src/index.js

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,44 @@ import utils from './utils.js'
33

44
let currentBench = "";
55

6-
new Doz({
7-
mixin: utils,
8-
root: '#main',
6+
Doz.component('x-table', {
97
store: 'list',
108
props: {
119
rows: []
1210
},
11+
template(h) {
12+
return h`
13+
<table class="table table-hover table-striped test-data">
14+
<tbody>
15+
${this.each(this.props.rows, row => `
16+
<tr>
17+
<td class="col-md-1">${row.id}</td>
18+
<td class="col-md-4">${row.label}</td>
19+
<td class="col-md-1">
20+
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
21+
</td>
22+
<td class="col-md-6"></td>
23+
</tr>`
24+
)}
25+
</tbody>
26+
</table>
27+
`
28+
},
29+
onCreate() {
30+
},
31+
32+
onBeforeUpdate() {
33+
console.time(currentBench = 'update');
34+
},
35+
36+
onUpdate() {
37+
console.timeEnd(currentBench);
38+
}
39+
});
40+
41+
new Doz({
42+
mixin: utils,
43+
root: '#main',
1344
template(h) {
1445
return h`
1546
<div class="container">
@@ -42,32 +73,9 @@ new Doz({
4273
</div>
4374
</div>
4475
</div>
45-
<table class="table table-hover table-striped test-data">
46-
<tbody>
47-
${this.each(this.props.rows, row => `
48-
<tr>
49-
<td class="col-md-1">${row.id}</td>
50-
<td class="col-md-4">${row.label}</td>
51-
<td class="col-md-1">
52-
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
53-
</td>
54-
<td class="col-md-6"></td>
55-
</tr>`
56-
)}
57-
</tbody>
58-
</table>
76+
<x-table></x-table>
5977
<span class="preloadicon glyphicon glyphicon-remove" aria-hidden="true"></span>
6078
</div>
6179
`
62-
},
63-
64-
onCreate() {
65-
this.currentBench = '';
66-
this.rows = [];
67-
},
68-
69-
onUpdate() {
70-
console.log('update', this.currentBench);
71-
console.timeEnd(this.currentBench);
7280
}
7381
});

0 commit comments

Comments
 (0)