-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmock4tpl.html
110 lines (109 loc) · 3 KB
/
mock4tpl.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Basic Test Suite</title>
<!-- Load local QUnit. -->
<link rel="stylesheet" href="../node_modules/grunt-contrib-qunit/test/libs/qunit.css" media="screen">
<script src="../node_modules/grunt-contrib-qunit/test/libs/qunit.js"></script>
<!-- Load local lib and tests. -->
<script src="../dist/mock.js"></script>
<script src="../node_modules/handlebars/dist/handlebars.js"></script>
</head>
<body>
<script type="text/javascript">
var tpl = Mock.heredoc(function() {
/*
<div bx-tmpl="list" bx-datakey="list">
<table class="table" bx-name="tables" bx-path="brix/gallery/tables/" id="tables">
<thead>
<tr>
<th></th>
<th>访问来源</th>
<th width="200px">UV占比</th>
<th>UV</th>
<th>PV</th>
<th>人均页面访问数</th>
<th>宝贝收藏数</th>
<th>收藏率</th>
<th>成交金额</th>
<th>转化率</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{{#each list}}
<tr class="tr-parent bold">
<td><i mx-click="toggle" class="J_expendCollapse icon-expend"></i></td>
<td>{{id}} {{分组}}</td>
<td>
<span class="process-parent" style="width: {{UV占比}}px;"></span>
{{UV占比}}%
</td>
<td>{{UV}}</td>
<td>{{PV}}</td>
<td>{{人均页面访问数}}</td>
<td>{{宝贝收藏数}}</td>
<td>{{收藏率}}</td>
<td>{{成交金额}}</td>
<td>{{转化率}}</td>
<td>
</td>
</tr>
{{#each children}}
<tr class="tr-child">
<td></td>
<td>{{渠道}}</td>
<td>
<span class="process-child" style="width: {{UV占比}}px;"></span>
{{UV占比}}%
</td>
<td>{{UV}}</td>
<td>{{PV}}</td>
<td>{{人均页面访问数}}</td>
<td>{{宝贝收藏数}}</td>
<td>{{收藏率}}</td>
<td>{{成交金额}}</td>
<td>{{转化率}}</td>
<td>
<div class="operation">
<a href="javascript:" mx-click="perspective{ srcIdLevel1:{{srcIdLevel1}},srcIdLevel2:{{srcIdLevel2}},channel:{{渠道}},vs:{{vs}} }" class="mr10">透视分析</a>
</div>
</td>
</tr>
{{/each}}
{{/each}}
</tbody>
</table>
</div>
<!-- Mock {
'id|+1': 1,
'list|1-5': [],
'children|1-5': [],
'分组|1': '@AREA',
'渠道|1': '@REGION',
'percent|1-100': 1,
'UV占比|1-100': 1,
'UV|1-100000000': 1,
'PV|1-100000000': 1,
'人均页面访问数|1-100000000': 1,
'宝贝收藏数|1-100000000': 1,
'收藏率': '@percent%',
'成交金额|1-100000000.2': 1.0,
'转化率': '@INTEGER(1,100)%',
'srcIdLevel1|1-10': 1,
'srcIdLevel2|1-10': 1,
'vs': '@渠道'
}
-->
*/
})
test('mock4tpl', function() {
var data = Mock.tpl(tpl);
ok(data.list.length)
})
</script>
<div id="qunit"></div>
<div id="qunit-fixture"></div
</body>
</html>