avalon2
Version:
an elegant efficient express mvvm framework
46 lines (40 loc) • 1.26 kB
HTML
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../../dist/avalon.js"></script>
<script>
var vm = avalon.define({
$id: 'for',
buttonText: "点我",
arr: [[[111,222,333],[444,555,666]], [[1,2,3],[4,5,6]]],
aa: function (a) {
console.log(a)
},
a: 1,
click: function () {
vm.arr = [ [[1,2,3],[4,5,6]],[[111,222,333],[444,555,666]]]
}
})
/*
* <ul>
<li :for="el in @array">{{el}}</li>
</ul>
*/
</script>
</head>
<body>
<div :controller='for'>
<table>
<tr :for="el in @arr">
<td :for="elem in el" :attr="{title:elem.length}" >
<div :for="item in elem" :html='item'></div>
</td>
</tr>
</table>
<p><button type="button" :click="@click" >{{@buttonText}}</button></p>
</div>
</body>
</html>