Small Program (18) picker component details, small program picker
Picker selectors are divided into three types: Common selector and time selector. The date selector is distinguished by the mode attribute. The default value is normal selector. During the test, the time and date click did not respond. I don't know if it's a BUG or something! No way to test the phone. I don't know what's going on now !!
Main attributes:
Common Selector
Time Selector
Date Selector
Wxml
<View> normal selector </view> <! -- Mode: index bindchange event listener selected by default for selector range data source value --> <picker mode = "selector" range = "{array}" value = "{index }}" bindchange = "listenerPickerSelected"> <text >{{ array [index] }}</text> </picker> <view> time selector </view> <picker mode = "time "value =" {time }}" start = "06:00" end = "24:00" bindchange = "listenerTimePickerSelected"> <text >{{ time }}</text> </ picker> <view> date selector </view> <picker mode = "date" value = "{date}" start = "2016-09-26" end = "2017-10-10" bindchange =" listenerDatePickerSelected "> <text >{{ date }}</text> </picker>
Js
Page ({data: {// text: "This is a Page" array: ['android', 'ios ', 'reactnativ', 'wechat', 'web'], index: 0, time: '08: 30', date: '2017-09-26 '},/*** listen to common picker selector */listenerPickerSelected: function (e) {// change the index value. Re-paint the interface using the setData () method. this. setData ({index: e. detail. value}) ;},/*** listener time picker selector */listenerTimePickerSelected: function (e) {// call setData () to re-draw this. setData ({time: e. detail. value,}) ;},/*** listener Date picker selector */listenerDatePickerSelected: function (e) {this. setDate ({date: e. detail. value})}, onLoad: function (options) {// parameters brought about by page navigation during page initialization options}, onReady: function () {// page rendering completed }, onShow: function () {// page display}, onHide: function () {// page hide}, onUnload: function () {// page close }})
Related Articles:
Hello WeApp icon component
Window text Component switch component
Tabss component action-sheet
Application lifecycle button Component modal component
Page lifecycle checkbox component toast component
Modular Details form component details loading component
Data Binding input component navigator component
View component picker component audio component
Scroll-view component radio component video component
Swiper component slider component Image component