使用方法:
(1)下载picker_datetime.js 与 picker_datetime.wxml文件到本地
(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
;
}