<picker bindchange="bindPickerChange" value="{{in}}" range="{{array}}" range-key="name">
<view class="picker picker_next">
{{array[in].name}}
<text wx:if="{{in==''}}" class="c_cb">请选择任务分类</text>
</view>
</picker>
bindPickerChange: function (e) {
this.setData({
rwfla:true
}),
console.log('picker发送选择改变,携带值为', this.data.array[e.detail.value].id)
this.setData({
in: e.detail.value,
inid: this.data.array[e.detail.value].id
})
},
//拿下拉框数据
businessRequest.getData('Personal/getCategory', this, {
}, res => {
let arr = res.data.data_list;
console.log(arr);
this.setData({
array: arr,
})
// console.log(res.data.data_list);
// let arr = [];
// for (let i = 0; i < res.data.data_list.length; i++) {
// let data_list = res.data.data_list[i].name;
// arr.push(data_list);
// }
// that.setData({
// array: arr
// })
// console.log(arr);
})
//拿到的数据
[{id: 1, name: "红包任务"},
{id: 2, name: "简单任务"},
{id: 3, name: "高额赏金"}]