解决了吗
vant的picker的data传值在下面的代码中后台js想用不同的选择器对应的data-id, 但是后台打印出来永远是lists的最后index的值:在这里想要每一个index下的data-id值。 <block wx:for="{{lists}}" wx:key="{{index}}"> <van-field required class="shangpin_div" value="" name="commodity" label="商品名称{{index+1}}" placeholder="请输入商品名称" data-id='{{index}}' bindchange="bindCommodityDataChang" /> <van-field value="{{unitOfMeasureShow[index]}}" required clearable label="计量单位" readonly="true" icon="exchange" placeholder="请选择计量单位" bind:click-icon="onClickIcon" /> <van-popup show="{{ show }}" position="bottom" overlay="{{ false }}" bind:close="onClose" > <van-picker show-toolbar title="计量单位" columns="{{ unitOfMeasurement }}" bind:cancel="onCancel" bind:confirm="onChangeUnitMeasure" data-id='{{index}}' /> </van-popup> <van-field class="shangpindanjia_div" type ="number" value="" name="commodityprice" label="商品单价" required placeholder="请输入商品单价" data-id='{{index}}' bindchange="addCommodityPrice" /> </block>
2023-05-16