-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathindex5.html
51 lines (50 loc) · 1.24 KB
/
index5.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>新组件系统测试</title>
<script type="text/javascript" src="../../dist/avalon.js"></script>
</head>
<body>
<div ms-controller='widget1' >
<div ms-if="@bbb">
<ms-button >{{@aaa}}</ms-button>
</div>
<p ms-attr='{title:@ddd}'>这个元素不受影响</p>
</div>
<h1>使用ms-if, 开始看不见, 后来又出现 </h1>
<script type="text/javascript">
avalon.component('ms-button', {
template: '<button type="button" ><span><slot /></span></button>',
defaults: {
buttonText: "button",
onInit: function (e) {
avalon.log(e.type)
},
onReady: function (e) {
avalon.log(e.type)
},
onViewChange: function (e) {
avalon.log(e.type)
},
onDispose: function (e) {
avalon.log(e.type)
}
},
soleSlot: 'buttonText'
})
var vm = avalon.define({
$id: 'widget1',
aaa: 111,
bbb: false,
ddd: '333'
})
setTimeout(function () {
vm.bbb = true
setTimeout(function () {
vm.bbb = false
}, 2300)
}, 2300)
</script>
</body>
</html>