滚动选择器
picker 从底部弹起的滚动选择器。
mode | 合法值 |
---|---|
selector | 普通选择器 |
multiSelector | 多列选择器 |
time | 时间选择器 |
date | 日期选择器 |
region | 省市区选择器 |
我在这里用的是 时间选择器 time
wxml
<view class="top grid">
<label class="title col-0">出生年月:</label>
<view class="section">
<picker mode="date" start="1800-01-01" end="2050-01-01" bindchange="bindDateChange">{{date}} // mode="date" 即使控制选择器的关键
</picker>
</view>
</view>
js
data:{
date: '2021-04-12',
}
bindDateChange: function (e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.setData({ // 将用户选择的时间返回
date: e.detail.value
})
},