代码拉取完成,页面将自动刷新
<!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>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。