<picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}"> <view class='choseQuestion' > {{choseQuestionBank}} </view> </picker> |
Page({ data:{ array:['全部','计算机网络','算法','数据结构','linux'], type:0, choseQuestionBank:"点击选择" }, bindPickerChange: function (e) { var that=this console.log('picker发送选择改变,携带值为', e.detail.value) this.setData({ type: e.detail.value, choseQuestionBank: that.data.array[e.detail.value] }) }, }) |