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-07-27
  • 2022-01-30
  • 2021-09-18
  • 2021-09-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-09-24
相关资源
相似解决方案