File tree Expand file tree Collapse file tree 1 file changed +35
-27
lines changed Expand file tree Collapse file tree 1 file changed +35
-27
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,44 @@ import utils from './utils.js'
3
3
4
4
let currentBench = "" ;
5
5
6
- new Doz ( {
7
- mixin : utils ,
8
- root : '#main' ,
6
+ Doz . component ( 'x-table' , {
9
7
store : 'list' ,
10
8
props : {
11
9
rows : [ ]
12
10
} ,
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' ,
13
44
template ( h ) {
14
45
return h `
15
46
<div class="container">
@@ -42,32 +73,9 @@ new Doz({
42
73
</div>
43
74
</div>
44
75
</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>
59
77
<span class="preloadicon glyphicon glyphicon-remove" aria-hidden="true"></span>
60
78
</div>
61
79
`
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 ) ;
72
80
}
73
81
} ) ;
You can’t perform that action at this time.
0 commit comments