UNPKG

avalon2

Version:

an elegant efficient express mvvm framework

43 lines (40 loc) 1.19 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <script type="text/javascript" src="../../dist/avalon.js"></script> <style> .c-red { color: red; } .c-green { color: green; } .c-blue { color: blue; } </style> <script> var vm = avalon.define({ $id: "test", arr: [ {a: 'a1', b: 'b1'}, {a: 'a2', b: 'b2'}, {a: 'a3', b: 'b3'} ] }); </script> </head> <body> <div ms-controller="test"> <!--ms-for:(idx1, item1) in @arr--> <p>Group这是标题</p> <!--ms-for:(idx2, item2) in item1--> <div>&nbsp;&nbsp;</div> <div ms-if="idx2%2==0">测试 </div> <div ms-class="'c-' + (idx1 < 1 ? 'red' : idx1 > 1 ? 'green' : 'blue')"> 内容2 {{ (idx1 < 1 ? 'red' : idx1 > 1 ? 'green' : 'blue') + '-' + item2 }} </div> <!--ms-for-end:--> <!--ms-for-end:--> </div> </body> </html>