zoukankan      html  css  js  c++  java
  • picker多级选择器的使用————小程序

    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]//值要定义过才能用
        })
      },
    
  • 相关阅读:
    双端队列广搜
    多源bfs
    leetcode刷题-67二进制求和
    leetcode刷题-66加一
    leetcode刷题-64最小路径和
    leetcode刷题-62不同路径2
    leetcode刷题-62不同路径
    leetcode刷题-61旋转链表
    leetcode刷题-60第k个队列
    leetcode刷题-59螺旋矩阵2
  • 原文地址:https://www.cnblogs.com/cth0/p/11568725.html
Copyright © 2011-2022 走看看