标签:change bsp hover fine class 属性 cli push script
HTML正文:
<body ms-controller="ex"> <div class="ms-hover" ms-click="change(‘array‘)"> <div ms-repeat="array">{{el}}</div> </div> </body>
Javascript操作代码:
//对象数组子元素的监听 var vm=avalon.define({ $id:"ex", aaa:{bbb:{ccc:1}}, array:[1,2], change:function(aaa){ vm[aaa].push(new Date-1); } }); //监听子孙元素只需在该元素的父元素上监听将子元素看作是父元素的一个属性 vm.aaa.bbb.$watch("ccc",function(a,b){ avalon.log(a,b); }); setTimeout(function(){ vm.aaa.bbb.ccc=new Date-0; }, 2000); //watch:监听array的属性length的值:数组只能监听到数组长度 vm.array.$watch("length",function(a,b){ avalon.log("length:"+a+"--"+b); });
标签:change bsp hover fine class 属性 cli push script
原文地址:https://www.cnblogs.com/guohu/p/9276924.html