加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

微信小程序 选项 、时间日期选择器

发布时间:2020-12-16 23:38:50 所属栏目:百科 来源:网络整理
导读:wxml: view class ="section" picker bindchange ="bindPickerChange" value ="{{index}}" range ="{{objectArray}}" mode = "selector" view class ="picker" 国家:{{objectArray[index]}} / view / picker / view view class ="section" picker mode ="t

wxml:

<view class="section" >  
  <picker bindchange="bindPickerChange" value="{{index}}" range="{{objectArray}}" mode = "selector">  
    <view class="picker">  
      国家:{{objectArray[index]}}  
    </view>  
  </picker>  
</view>  

<view class="section">  
  <picker mode="time" value="{{time}}" start="00:00" end="23:59" bindchange="bindTimeChange">  
    <view class="picker">  
     时间 : {{times}}
    </view>  
  </picker>  
</view>  
<view class="section">  
  <picker mode="date" value="{{date}}" start="1978-01-01" end="2017-1-23" bindchange="bindDateChange">  
    <view class="picker">  
      日期: {{dates}}  
    </view>  
  </picker>  
</view>  

js:

Page({
  data: {
    dates: ‘2016-11-08‘,times: ‘12:00‘,objectArray: [‘中国‘,‘英国‘,‘美国‘],index: 0,},//  点击时间组件确定事件  
  bindTimeChange: function (e) {
    console.log("谁哦按")
    this.setData({
      times: e.detail.value
    })
  },//  点击日期组件确定事件  
  bindDateChange: function (e) {
     console.log(e.detail.value)
    this.setData({
      dates: e.detail.value
    })
  },//  点击城市组件确定事件  
  bindPickerChange: function (e) {
     console.log(e.detail.value)
    this.setData({
      index: e.detail.value
    })
  }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读