forked from RubyLouvre/avalon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex25if.html
58 lines (51 loc) · 1.73 KB
/
index25if.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
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="avalon.js" type="text/javascript"></script>
<style>
#aaa{
width:200px;
height:200px;
background: red;
display:none;
}
</style>
</head>
<body>
<script type="text/javascript">
var model = avalon.define('TestCtrl', function(vm) {
vm.aaa = true
vm.bbb = 2222
})
window.onload = function() {
var removeEl = document.getElementById("removeEl")
setTimeout(function() {
model.bbb = 333333
}, 1000)
setTimeout(function() {
model.aaa = false
console.log("以绑定方式移除DOM树")
}, 3000)
// setTimeout(function() {
// removeEl.parentNode.removeChild(removeEl)
// console.log("以非绑定方式移除DOM树")
// }, 3000)
setTimeout(function() {
console.log("改变被移除元素的绑定值")
model.bbb = 444444
}, 4000)
setTimeout(function() {
model.aaa = true
}, 6000)
}
</script>
<div id="testDiv" ms-controller="TestCtrl" >
<div ms-if="aaa" id="remove">
<div ms-text="bbb" id="removeEl"></div>
</div>
<div ms-if="aaa" ms-include-src="'index25iftmpl.html'" id='eee'></div>
</div>
</body>
</html>