< picker bindchange = "bindPickerChange" value = "{{teamArr}}" range = "{{selfInfo}}" range-key = "selfInfo" > < view class = "picker" > 当前选择:{{selfInfo[index]}} </ view > </ picker > |
success: function (res) { console.log(res) for ( var i = 0 ; i < res.data.page.list.length;i++){ teamArr.push(res.data.page.list[i].id); teamLis.push(res.data.page.list[i].name) } console.log(teamArr) console.log(teamLis) that.setData({ selfInfo: teamLis, flag: true }) } |
接口返回的是一个对象数组,我设置了两个变量,一个接收name,一个接收Id,但返回的还是下标,麻烦大神指导一下
拿到index在你的数组里面去循环找出这个index对应的name和id就好了