首页 > 代码库 > avalone (指令v-for的用法)

avalone (指令v-for的用法)

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>avalon使用例子 v-for的例子</title>
</head>
<body>
	<script src="http://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>

  

avalone (指令v-for的用法)