<view>{{year}}年{{month}}月{{day}}日{{hour}}:{{minute}}
indicator-style="height: 50px;"
style="width: 100%; height: 300px;"
value="{{value}}"
bindchange="bindChange"
>
<view wx:for="{{years}}" style="line-height: 30px">{{item}}年
<view wx:for="{{months}}" style="line-height: 30px">{{item}}月
<view wx:for="{{days}}" style="line-height: 30px">{{item}}日
<view wx:for="{{hours}}" style="line-height: 30px">{{item}}时
<view wx:for="{{minutes}}" style="line-height: 30px">{{item}}分
import wepyfrom 'wepy'
const date =new Date()
const years = []
const months = []
const days = []
const hours = []
const minutes = []
for (let i =1990; i <= date.getFullYear(); i++) {
years.push(i)
}
for (let i =1; i <=12; i++) {
months.push(i)
}
for (let i =1; i <=31; i++) {
days.push(i)
}
for (let i =1; i <=24; i++) {
hours.push(i)
}
for (let i =1; i <=60; i++) {
minutes.push(i)
}
export default class noticextends wepy.page {
data = {
years,
year: date.getFullYear(),
months,
month:2,
days,
hour: date.getHours(),
minute: date.getMinutes(),
hours,
minutes,
day:2,
value: [9999, 1, 1]
}
methods = {
bindChange(e) {
const val = e.detail.value
let that =this
this.year = that.data.years[val[0]]
this.month = that.data.months[val[1]]
this.day = that.data.days[val[2]]
this.$apply()
}
}
}
网友评论