<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="../js/Vue.js" charset="utf-8"></script>
<script type="text/javascript">
window.onload = function(){
var vm = new Vue({
el:'.box',
data:{
arr:['app','orange','pare'],
json:{a:'app',b:'banana',c:'ccc',d:'dog'}
}
});
}
</script>
</head>
<body>
<div class="box">
<ul>
<li v-for='(value,index) in arr'>{{value}} {{index}}</li>
</ul>
<hr />
<ul>
<li v-for='(value,index) in json'>{{value}} {{index}}</li>
</ul>
<hr />
<ul>
<li v-for='(k,v,index) in json'>{{k}} {{v}} {{index}}</li>
</ul>
</div>
</body>
</html>
Vue常用指令v-for
最新推荐文章于 2024-08-21 15:38:24 发布