This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathbrix.html
135 lines (135 loc) · 4.74 KB
/
brix.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>brix tmpl test</title>
<link type="text/css" rel="stylesheet" href="../../src/style/brix-min.css" charset="utf-8">
<link type="text/css" rel="stylesheet" href="../../src/gallery/calendar/index.css" charset="utf-8">
<link rel="stylesheet" href="../assets/doc.css">
<script src="http://a.tbcdn.cn/s/kissy/1.3.0/seed.js" data-config="{combine:true}"></script>
<script src="../../src/core/brix.js"></script>
</head>
<body>
<div class="container">
</div>
<script type="text/javascript">
var list = {
a: 'a',
b: 'b',
c: 'c',
d: [{
a:'4',
d1: '1'
}, {
d1: '2'
}, {
d1: '3'
}, {
d1: function() {
return '4';
}
}],
e: true,
f: function() {
return 'xx';
},
g:[5,6,7],
startDay:'haha'
}
KISSY.ready(function(S){
S.use('brix/core/pagelet', function(S, Pagelet) {
window.pagelet = new Pagelet({
container: '.container',
tmpl: '#tmpl',
data: list,
config: {
brixtest: {
b: 2,
listeners: {
myfire: function(e) {
S.log(1)
}
}
}
},
renderer:{
xx:{
yy:function(){
return 'xx_yy_'+S.guid();
}
}
}
});
pagelet.ready(function() {
pagelet.setChunkData('b', 'bbb' + S.guid());
pagelet.setChunkData('c', 'ccc' + S.guid());
S.log(pagelet.getBrick('brixtest').testMethod());
})
});
});
</script>
<script type="text/tmpl" id="tmpl">
<div id="brixtest" bx-name="brixtest" bx-path="components/brixtest/">
<input id="input1" type="button" class="btn btn-red btn-size25" value="局部刷新a,c">
<input id="input2" type="button" class="btn btn-red btn-size25" value="局部刷新b-prepend">
<input id="input3" type="button" class="btn btn-red btn-size25" value="局部刷新c-append">
<input id="input4" type="button" class="btn btn-red btn-size25" value="局部刷新d">
<input id="input5" type="button" class="btn btn-red btn-size25" value="局部刷新e">
<input id="input6" type="button" class="btn btn-red btn-size25" value="自杀">
<input id="input7" type="button" class="btn btn-red btn-size25" value="startData">
<div id="xx" bx-tmpl="tmpl_a" class="hahah" bx-datakey="a" name="xx">
{{#a}}
<span>{{a}}</span>
{{/a}}
</div>
<div bx-tmpl="tmpl_b" bx-datakey="b">
<span>{{b}}</span>
<div bx-name="calendar" class="calendar" bx-config="{popup:false,autoRender:true,showTime:true}">
</div>
</div>
<div bx-tmpl="tmpl_c" bx-datakey='a, c' class="xx">
<span>{{a}}-{{c}}</span>
</div>
<div bx-tmpl="tmpl_d" bx-datakey="d">
<table>
<tbody>
{{#d}}
<tr>
<td>{{d1}}--{{a}}<td>
</tr>
{{/d}}
</tbody>
</table>
</div>
<div bx-tmpl="tmpl_e" bx-datakey="e" >
{{^e}}
<input type="text" value="{{e}}" />
{{/e}}
</div>
<p>function:</p>
<p>{{f}}</p>
<p>mustache Array “.”测试</p>
<table>
<tbody>
{{#g}}
<tr>
<td>{{.}}<td>
</tr>
{{/g}}
</tbody>
</table>
<p>bx-tmpl重名问题</p>
<div bx-tmpl="pagewbd" bx-datakey="startDay,days_html">
{{startDay}}
</div>
<p>renderer配置</p>
{{xx_yy}}
</div>
<!--需要保存的模板-->
{{#bx-tmpl-id}}
<span>{{a}}</span>
<span>{{b}}</span>
{{/bx-tmpl}}
</script>
</body>
</html>