//js
data:{
multiIndex: 0,
multiArray: [],
yuanxiku: [],
wenti:[]
},
// 多项选择器点击确定事件
bindMultiPickerChange: function (e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
if (e.detail.value.length == 0) {
return
}
else{
this.setData({
multiIndex: e.detail.value,
wenti:this.data.multiArray
})
}
},
// 多项选择器滑动事件
bindMultiPickerColumnChange: function (e) {
console.log('column', e.detail.column)
console.log('value', e.detail.value)
let data = {
multiArray: this.data.multiArray,
};
if (e.detail.column == 0) {
console.log('滑动')
data.multiArray[1] = this.data.yuanxiku[e.detail.value];
}
this.setData(data);
},
//wxml
<picker class="xuexiaoxuanze" mode="multiSelector" bindchange="bindMultiPickerChange" bindcolumnchange="bindMultiPickerColumnChange" value="{{multiIndex}}" range="{{multiArray}}" bindcancel="quxiao">
<view class="picker" wx:if="{{multiIndex}}">
{{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}}
</view>
<view wx:if="{{!multiIndex}}" class="tishi">请选择院系与专业</view>
</picker>