avalon.config({
loader: false
})
avalon.config({
loader: false
})
<script type="text/javascript">
avalon.ready(function(){//等页面加载完毕再执行avalon代码
avalon.define({
$id:"AAA",
name:"liger",
color:"green"
});
avalon.define({
$id:"BBB",
name:"sphinx",
color:"red"
})
avalon.define({
$id:"CCC",
name:"dragon"
})
avalon.scan();//扫描html将插值表达式转化为正常的浏览器html代码段
})
</script>
</head>
<body>
<div ms-controller="AAA">
<div>{{name}}:{{color}}</div>
<div ms-controller="BBB">
<div>{{name}}:{{color}}</div>
<div ms-controller="CCC">
<div>{{name}}:{{color}}</div><!-- 向上继承color的值 -->
</div>
</div>
</div>
</body>
<script type="text/javascript">
avalon.ready(function(){//等页面加载完毕再执行avalon代码
avalon.define({
$id:"CCC",
name:"dragon",
color:"red"
})
avalon.define({
$id:"DDD",
name:"sorice"
});
avalon.scan();//扫描html将插值表达式转化为正常的浏览器html代码段
})
</script>
</head>
<body>
<div ms-controller="CCC">
<div>{{name}}:{{color}}</div><!-- 向上继承color的值 -->
<div ms-important="DDD"><!-- 不会向上查到ViewMolde属性 -->
<div>{{name}}:{{color}}</div>
</div>
</div>
</body>
<script type="text/javascript">
avalon.ready(function(){//等页面加载完毕再执行avalon代码
avalon.define({
$id:"DDD",
name:"sorice"
});
avalon.define({
$id:"EEE",
name:"static",
color:"reads"
})
avalon.scan();//扫描html将插值表达式转化为正常的浏览器html代码段
})
</script>
</head>
<body>
<div ms-skip="EEE"><!-- 直接输出插值表达式,不会输出插值表达式的值,也不会继承 -->
<div>{{name}}:{{color}}</div>
</div>
</body>
原文:http://www.cnblogs.com/Zjingwen/p/4455733.html