我需要把object

 <div v-for="item in object">{{  item }} 发现打印出来不是tuble 而是其value值,才发现v-for这么写适用于array而不适用于object,
{
   "tube1":1,
   "tube2":2,
   "tube3":3
}

展示出来,貌似v-for只对array有效,我该怎么做?

如果你习惯了这样写却没有注意,其实vue是支持的,只要改一下写法即可

 

<div v-for="(vulue, key) in countInfo" :key="key" :class="'cell ' + key">
<div>{{value}}</div>
</div>
传送门,官方文档也写了针对object属性的遍历

https://cn.vuejs.org/v2/guide/list.html

相关文章:

  • 2021-06-28
  • 2021-12-02
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
猜你喜欢
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案