微信小程序picker组件关于objectArray数据类型的绑定方法
html
<picker bindchange="bindPickerChange" value="{
{index}}" range-key="title" range="{
{array}}">
<view class="tongcheng_sita">
<text class="tongcheng_sita_text">{
{array[index].title}}</text>
<image class="tongcheng_sita_img" src="/components/images/a_nav_down.png"></image>
</view>
</picker>
js
import array from '../../datas/professions.js';
data: {
array: [],
index: 0,
},
bindPickerChange: function (e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.setData({
index: e.detail.value
})
},
bindRegionChange: function (e) {
// console.log('picker发送选择改变,携带值为', e