-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
55 lines (53 loc) · 908 Bytes
/
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
<style>
* {
font-family: Consolas, 微软雅黑;
color: #666;
}
.green {
color: #42b983;
}
.demo {
box-shadow: 2px 2px 8px rgb(204, 204, 204);
padding: 30px;
margin: 30px;
}
label span {
width: 80px;
display: inline-block;
}
</style>
<script src='./mvvm.js'></script>
<div id='demo1' class='demo'>
Hello <span class='{{css}}' data-text='xx'>{{name}}</span>!
<br>
<p>now is {{time}}</p>
</div>
<div id='demo2' class='demo'>
<label><span>name:</span>
<input name='name'>
</label>
<br>
<label><span>password:</span>
<input name='password'>
</label>
<pre>{
name: {{name}},
passowrd: {{password}}
}</pre>
</div>
<script>
var demo1 = mvvm('#demo1', {
name: 'Monkey',
time: Date(),
css: 'green'
})
setInterval(function() {
demo1.model.time = Date()
}, 1000)
mvvm(document.querySelector('#demo2'), {
name: '',
password: ''
}, {
type: 'form'
})
</script>