v-for遍历对象
作者:互联网
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <!--引入最新的vue稳定版本--> <script type="text/javascript" src="https://unpkg.com/vue/dist/vue.min.js"></script> <link rel="stylesheet" href="./css/style.css" type="text/css"> </head> <body> <!--使用v-for遍历对象属性--> <div id="app"> <ul> <li v-for="(value,key,index) in user"> 角标:{{index}}------ 键名: {{key}} ------ 值:{{value}} </li> </ul> </div> <script> var vue=new Vue({ el:'#app', data:{ user:{ name: 'SkyManss', gender: '男', age: 26 } } }); </script> </body> </html>
标签:el,遍历,键名,Title,对象,index,app,------ 来源: https://www.cnblogs.com/cjxstart/p/16035097.html