vue循环遍历List,Map,Array

1、list :

  v-for循环对象数组

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <script src=""></script> <body> <div> <!-- 不一定非用item, 可以换 --> <p v-for="user in list">{{ user.id }} --- {{user.name}}</p> ======================================================================= <p v-for="(user,i) in list">Id:{{user.id}} --- name:{{user.name}} --- 索引:{{i}}</p> </div> </body> </html> <script> var vm = new Vue({ el:\'#app\', data:{ list:[ {id:1,name:\'aa\'}, {id:2,name:\'bb\'}, {id:3,name:\'cc\'}, {id:4,name:"dd"} ] }, methods:{} }) </script>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zgdgfj.html