美文网首页
VUE学习笔记008 v-for 遍历数组和对象

VUE学习笔记008 v-for 遍历数组和对象

作者: 梦想_15eb | 来源:发表于2019-02-02 12:50 被阅读0次

    遍历数组

    characters:["aaaaaa","bbbbbbb","cccccccccc"]

    <li v-for=" character in characters"> 

            character

    </li>

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    遍历对象

    users:[

    {name:"aaaaaaa",age:"10"},

    {name:"bbbbbb",age:"20"},

    {name:"ccccc",age:"30"},

    ]

    <li  v-for="(user,incex)  in users"  >

            {{index+1}}. {{user.name}}  --{{user.age}}

    </li>

    +++++++++++++++++++++++++++

    两层循环

    <template  v-for="(user,index)  in users"  >

            <div v-for="(val, key)  in user"></div>

    </template>

    相关文章

      网友评论

          本文标题:VUE学习笔记008 v-for 遍历数组和对象

          本文链接:https://www.haomeiwen.com/subject/wojssqtx.html