wxml
<picker bindChange="watchSite" mode="selector" mode:value="{{site}}" range="{{trainList}}" range-key="name">
<!--site为数组对象的序列号,range-key是对象内需要展示的属性名--> <view class="picker"> 当前选择:{{trainList[site].name}} </view> </picker>
js
data:{ trainList:[ { name:'上海' value:0 }, { name:'南京' value:1 }, { name:'北京' value:2 }, ], site:0 }, watchSite(e) { this.setData({ site: e.detail.value }) console.log('picker发送选择改变,携带值为', e.detail.value) },