uniapp循环里面使用picker
作者:互联网
<view class="purchase-item" v-for="(item,index) in orderList" :key="index">
<picker
@change="bindPickerChange(index,$event)"
range-key="name" /*显示supplierList列表中哪个属性*/
:value="supplierList[supplierIndex].name"
:range="supplierList">
<view class="uni-input">{{item.supplier_name}}</view>
</picker>
</view>
orderList:[], //总列表
supplierList:[], //下拉列表
supplierIndex:0 //下拉下标
bindPickerChange(i,e) {
this.orderList[i].supplier_id = this.supplierList[e.detail.value].id
this.orderList[i].supplier_name = this.supplierList[e.detail.value].name
},
loadData() {
this.orderList.map(x => {
this.$set(x, 'amountBefore', 0)
this.$set(x, 'supplier_name', '请选择')
})
}
标签:picker,uniapp,name,orderList,value,列表,循环,supplierList,supplier 来源: https://blog.csdn.net/Guoyu1_/article/details/120098395