1. 程式人生 > >微信小程式例子——使用picker實現時間和日期選擇框

微信小程式例子——使用picker實現時間和日期選擇框

1、效果展示


2、關鍵程式碼

index.wxml


    當前城市選擇:{{picker1Range[picker1Value]}}

  當前時間選擇: {{timeValue}}

	當前日期選擇: {{dateValue}}

index.js

Page({
  data:{
    // text:"這是一個頁面"
    picker1Value:0,
    picker1Range:['北京','上海','廣州','深圳'],
    timeValue:'08:08',
    dateValue:'2016-10-13'
  },
  normalPickerBindchange:function(e){
    this.setData({
      picker1Value:e.detail.value
    })
  },
  timePickerBindchange:function(e){
    this.setData({
      timeValue:e.detail.value
    })
  },
  datePickerBindchange:function(e){
    this.setData({
      dateValue:e.detail.value
    })
  }
})

3、原始碼獲取方式

百度雲連結:http://pan.baidu.com/s/1o767mkU

4、在使用picker元件實現時間和日期選擇器的過程中有遇到任何問題或者不明白的地方,歡迎新增我的微信進行諮詢,感謝支援!微訊號:FutureJet

5、覺得不錯請打賞,您的十分滿意是筆者的無限動力。