1 Star 0 Fork 0

zhengchen/avalon

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
index_if3.html 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
qincheng 提交于 2014-02-09 12:15 . 重命名例子
<!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="'index_iftmpl.html'" id='eee'></div>
</div>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cowboy13/avalon.git
git@gitee.com:cowboy13/avalon.git
cowboy13
avalon
avalon
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385