Welink ui组件介绍Picker
Picker
多列选择器。Picker UI 提供与WeLink规范一致的视图。 主要包括:单列选择器、双列选择器、日期选择器。
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
<div class="page__bd page__bd_spacing">
<a href="javascript:;" class="weui-btn weui-btn_default" id="showPicker">单列选择器</a>
<a href="javascript:;" class="weui-btn weui-btn_default" id="showDoublePicker">双列选择器</a>
<a href="javascript:;" class="weui-btn weui-btn_default" id="showDatePicker">日期选择器</a>
</div>
<script type="text/javascript">
$('#showPicker').on('click', function () {
weui.picker([{
label: '飞机票',
value: 0
}, {
label: '火车票',
value: 1
}, {
label: '的士票',
value: 2
},{
label: '公交票 (disabled)',
disabled: true,
value: 3
}, {
label: '其他',
value: 4
}], {
defaultValue: [0],
onChange: function (result) {
console.log(result);
},
onConfirm: function (result) {
console.log(result);
}
});
});
$('#showDoublePicker').on('click', function () {
weui.picker([
{
label: '飞机票',
value: 0,
children: [
{
label: '经济舱',
value: 1
},
{
label: '商务舱',
value: 2
}
]
},
{
label: '火车票',
value: 1,
children: [
{
label: '卧铺',
value: 1
},
{
label: '坐票',
value: 2
},
{
label: '站票',
value: 3
}
]
},
{
label: '汽车票',
value: 3,
children: [
{
label: '快班',
value: 1
},
{
label: '普通',
value: 2
}
]
}
], {
defaultValue: [0],
onChange: function (result) {
console.log(result);
},
onConfirm: function (result) {
console.log(result);
}
});
});
$('#showDatePicker').on('click', function () {
weui.datePicker({
start: 1990,
end: new Date().getFullYear(),
onChange: function (result) {
console.log(result);
},
onConfirm: function (result) {
console.log(result);
}
});
});
</script>
- 点赞
- 收藏
- 关注作者
评论(0)