[微信小程序]时间选择器(年月日时分)datetime-picker

使用方法:

(1)下载picker_datetime.js 与 picker_datetime.wxml文件到本地

(2)在需要用到该选择器的wxml文件中,在底部引入picker_datetime.wxml


<include src="../tools/wxml/picker_datetime.wxml"/>

<view bindtap="startTap" class="form">开始时间:{{startDate}}</view>


<view bindtap="startTap" class="form">开始时间:{{startDate}}</view>

同时,在此Page页面的onLoad事件中,加入以下代码

this .datetimePicker = new pickerFile.pickerDatetime({
       page: this ,
       animation: 'slide' ,
       duration:500
     });


最后,在对应的tap事件中,设置一下选择器,如第二步的例子startTab,绑定的值为{{startDate}},则

startTap : function (){
     this .datetimePicker.setPicker( 'startDate' );
   }



.pick_datetime {
     position : fixed ;
     left : 0 ;
     bottom : 0 ;
     width : 100% ;
     overflow : hidden ;
}
.pick_datetime_tool {
     display :flex;
     justify- content :space-between;
     height : 92 rpx;
     line-height : 92 rpx;
     border-top : 4 rpx solid #eee ;
     border-bottom : 4 rpx solid #eee ;
     padding : 0 20 rpx;
}
.pick_datetime_ok { font-weight : bold ;}
.pick_datetime_clear { color : #666 ;}
.pick_datetime picker-view {
     font-size : 34 rpx;
}
.pick_datetime_column {
     height : 40px ;
     line-height : 40px ;
     text-align : center ;
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值