首页 > 微信 > 详细

picker多级选择器的使用————小程序

时间:2019-09-22 19:53:09      阅读:148      评论:0      收藏:0      [点我收藏+]

picker多级选择器的使用————小程序

picker是选择器来着,既然选择了,就希望可以获取选择的数据。

index.html

<view>picker获取数据</view>
<view class="cu-form-group margin-top">
  <picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">//改变bindchange后,执行bindPickerChange。
    <view class="picker">当前选择:{{array[index]}}</view>
  </picker>
</view>
<view class="picker">当前选择:{{array[index]}}</view>//任何数据能读出来的才叫好数据。
<view class="picker">当前选择:{{userChange}}</view>

index.js

  bindPickerChange: function (e) {
    console.log('picker发送选择改变,携带下标为', e.detail.value)//获取选择的值的下标value
    console.log('picker发送选择改变,携带值为', this.data.array[e.detail.value])//获取选择的值
    this.setData({
      index: e.detail.value,//值要定义过才能用
      userChange:this.data.array[e.detail.value]//值要定义过才能用
    })
  },

picker多级选择器的使用————小程序

原文:https://www.cnblogs.com/cth0/p/11568725.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!