<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>avalon使用例子 v-for的例子</title> </head> <body> <script src="//cdn.bootcss.com/avalon.js/2.0s/avalon.min.js"></script> <!-- html --> <div ms-controller="page"> <ul> <li ms-for="(i,v) in @data.arrList"> <input type="text" ms-duplex="v.name">{{v.name}} <button ms-click="@methods.get(v.name)">按钮</button> </li> </ul> </div> <!-- js --> <script> var vm = avalon.define({ $id:‘page‘, data:{ arrList:[ {name:"ajia",sex:"boy"}, {name:"ajia1",sex:"boy1"}, {name:"ajia2",sex:"boy2"} ] }, methods:{ get:function(index){ console.log(index); } } }) </script> </body> </html>
时间: 2024-11-08 19:01:17