比當前滴滴更好的時間選擇器,可以選擇未來三天的日期、小時、分鐘。
export
class
datepicker
// 年月日時分
this
.year =
this
.date.
getfullyear()
;this
.month =
this
.date.
getmonth()
+1;this
.day =
this
.date.
getdate()
;this
.hours =
this
.date.
gethours()
;this
.minutes =
this
.date.
getminutes()
;// 構造dateall和currentdatearr
let currentdatearr =
;let dateall =[[
],,]
;let defaultdate =
this
.getnowdate()
; dateall[0]
=['今天'
,'明天'
,'後天'];
dateall[1]
=this
.getlooparray
(this
.hours,23,
'h')
; dateall[2]
=this
.getlooparray
(this
.minutes,59,
'm',5)
; dateall.
find
((item, index)
=>
)// 構造datearr
this
.datearr =
}// 2.數字變兩位字串
withzero
(params)
// 3.返回陣列(公差為interval的等差數列)
getlooparray
(start, end, type, interval =1)
return array;
}// 4.獲取當前時間
getnowdate()
// 5.重置datearr的dateall和currentdatearr
resetpicker
(column, value)
else
if(value !=0)
// 滑動第2個滑輪
}else
if(column ==1)
else
// 滑動第3個滑輪
}else
if(column ==2)
}// 6.轉換成date物件
todate
(arrall, currentdate)
}
import
from
'../../utils/datepicker'
;page(,
// 2.載入時獲取日期的元件
onload()
// 給datepicker乙個時間引數
this
.setdata()
this
.set_date()
;},// 3.滑動選擇器時觸發的函式
datepickercolumnchange
(e),
// 4.確定選擇器時觸發的函式
datepickerchange
(e))},
// 5.賦值
set_date()
)},// 6.格式轉換
date2string
(date)年$
月$日 $
時$分` }
})
}
class
="section"
>
class
="section__title"
style
="margin-bottom
:0;"
>
>
mode
="multiselector"
range
="}"
value
="}"
bindchange
="datepickerchange"
bindcolumnchange
="datepickercolumnchange"
>
class
="section-val"
>
}view
>
picker
>
view
>
.picker
.section-val
.section
.section_title
時間選擇器
nsstring start 2016 2 2 08 00 nsstring end 2016 2 2 20 00 nstimeinterval interval 30 nsmutablearray arr cuttingdatetool nslog arr pickervc timepickerv...
時間選擇器
方式一 確定和取消按鈕在時間選擇器的底部 letalertcontroller uialertcontroller uialertcontroller title n n n n n n n n n message nil,preferredstyle uialertcontrollerstyle ...
時間選擇器
wxml 時間選擇器 選擇時分 日期選擇器 選擇年月日 國慶出遊 日期時間選擇器 精確到秒 日期時間選擇器 精確到分 jsvar datetimepicker require utils datetimepicker.js page onload changedate e changetime e ...