支付宝小程序实现object格式下拉选框
view
<view class="filter-item">
<picker onChange="bindStatusPickerChange" value="{{statusIndex}}" range-key="name" range="{{statusArr}}">
<view class="picker">
<text>状态</text>
<text class="iconfont icon-down"></text>
</view>
</picker>
</view>
js
statusArr: [
{
id: '',
name: '全部'
},
{
id: 0,
name: '在职'
},
{
id: 1,
name: '离职'
}
],
statusIndex: 0,
// 订单状态
bindStatusPickerChange(e) {
this.setData({
statusIndex: e.detail.value,
'filterData.status': this.data.statusArr[e.detail.value].id
},()=>{
this.getList()
})
},