<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="vue.js/vue.js"></script> <script src="vue.js/jquery-1.7.1.min.js"></script> </head> <body> <!--num就是$index--> <ul id="app"> <li v-for="(num,sss) of items"> {{num}}-{{sss.message}} </li> </ul> <script> var vm=new Vue({ el:"#app", data:{ items:[ {message:'one'}, {message:'two'}, {message:'three'} ] } }) vm.items.push({message:'four'}); </script> </body> </html>
v-for
最新推荐文章于 2024-08-11 18:40:36 发布