-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
61 lines (59 loc) · 1.86 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://olado.github.io/doT/doT.min.js"></script>
<script src="http://code.jquery.com/jquery.min.js"></script>
</head>
<body>
<div id="app">appdemo</div>
<script type="text/html" id="tpl">
<div>
<a>name:{{= it.name}}</a>
<ul>
{{~ it.items:project}}
<li>
<p>age:{{= project.id}}</p>
<p>name:{{= project.name}}</p>
<select >
{{~ it.arr:platform}}
<option {{? itemmatch2(project,platform) }} selected{{?}} value="{{=platform.id}}">
{{=platform.text}}
</option>
{{~}}
</select>
</li>
{{~}}
</ul>
</div>
</script>
<script>
function itemmatch2(itemmatch,item){
if(itemmatch.name==item.text){
return true
}
return false
}
var data ={
name:'stringParams1',
stringParams1:'stringParams1_value',
stringParams2:1,
items:[
{
id:1,
name:"val1"
},
{
id:2,
name:"val2"
}
],
arr:[{id:0,text:'val1'},{id:1,text:'val2'}]
}
$("#app").html(doT.template($("#tpl").html())(data));
</script>
</body>
</html>