antd 之TimePicker设置禁用时间
作者:互联网
- startTime: '00:00:00',
- endTime: '23:59:59'
getDisabledHours () {
let hours = []
let time = this.startTime
let timeArr = time.split(':')
for (var i = 0; i < parseInt(timeArr[0]); i++) {
hours.push(i)
}
return hours
},
getDisabledMinutes (selectedHour) {
let time = this.startTime
let timeArr = time.split(':')
let minutes = []
if (selectedHour == parseInt(timeArr[0])) {
for(var i = 0; i < parseInt(timeArr[1]); i++) {
minutes.push(i)
}
}
return minutes
},
getDisabledSeconds (selectedHour, selectedMinute) {
let time = this.startTime
let timeArr = time.split(':')
let second = []
if (selectedHour == parseInt(timeArr[0]) && selectedMinute == parseInt(timeArr[1])) {
for(var i = 0; i <= parseInt(timeArr[2]); i++) {
second.push(i)
}
}
return second
}
标签:禁用,hours,parseInt,TimePicker,let,time,var,antd,timeArr 来源: https://www.cnblogs.com/spy66/p/12098576.html