微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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', '请选择')
    })
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐