我想问一下如何取每个数组下的id?I would like to ask how to get the id under each array?
我想问一下如何取每个数组下的id?回答:
遍历数组
for 循环
// js:let list = []for (let i = 0; i < res.data.buildings.length; i++) { list.push(res.data.buildings[i].id)}console.log(list)// wxml: buildings: res.data.buildings<view wx:for="{{buildings}}" wx:key="id">{{item.id}}</view>
循环取
for循环了解一下
原文出处:我想问一下如何取每个数组下的id?
data.buildings.map(item=>{
return item.id
})