移动端日期选择,下拉框选择效果

DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>WeUItitle>
        
        <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
        
        <link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/weui/1.1.2/style/weui.css"/>
    head>
    <body>
        <div class="page">
            <div class="page__hd">
                <h1 class="page__title">Pickerh1>
                <p class="page__desc">多列选择器,需要配合js实现p>
            div>
            <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="showDatePicker">日期选择器a>
            div>
        div>
        
        <script src="https://cdn.bootcss.com/zepto/1.2.0/zepto.js" type="text/javascript" charset="utf-8">script>            
        
        <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.1.4/weui.min.js">script>
        
        
        
        <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
                }], {
                    onChange: function (result) {
                        console.log(result);
                    },
                    onConfirm: function (result) {
                        console.log(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>
    body>
html>

 

转载于:https://www.cnblogs.com/wangyongx/p/11526812.html

你可能感兴趣的:(移动端日期选择,下拉框选择效果)