v-for除了可以循环数组,还可以循环对象。

例子:

<template>
<div>
  <div v-for="(item,i) in obj">{{i}}--{{item}}</div>
</div>
</template>
<script>
export default {
  name: "HelloWorld",
  data () {
    return {
      obj:{
        age:1,
        name:"zs",
        sex:""
      }
    };
  }
}
</script>
<style lang="css" scoped>
</style>

结果:
vue中循环对象属性和属性值

 

相关文章:

  • 2021-12-09
  • 2021-10-13
  • 2021-11-30
  • 2021-10-15
  • 2021-09-28
  • 2021-10-13
  • 2021-05-14
  • 2021-11-30
猜你喜欢
  • 2021-10-13
  • 2021-11-22
  • 2020-09-29
  • 2021-12-19
  • 2021-11-05
  • 2018-01-16
相关资源
相似解决方案