vue的v-for数组和对象

v-for="(item,index) of hot"    //数组遍历


v-for="(item,key,index) of cities"   //对象遍历
//key 是对象的属性     item对应的属性值

 key值

 <div class="area" v-for="(item,key) of cities" :key="key">  
        <div class="title border-topbottom">{{key}}</div>
        <div class="item-list">
          <div class="item border-bottom" v-for="city of item " :key="city.id">{{city.name}}</div>
        </div>
</div>

  

猜你喜欢

转载自www.cnblogs.com/chenlw/p/9719416.html