2019-11-29 15:24:37 +08:00
|
|
|
# Disabled Time
|
|
|
|
```html
|
|
|
|
<n-time-picker
|
|
|
|
v-model="time0"
|
2019-12-04 11:05:05 +08:00
|
|
|
:hourDisabled="disabledHours"
|
|
|
|
:minuteDisabled="disabledMinutes"
|
|
|
|
:secondDisabled="disabledSeconds"
|
2019-11-29 15:24:37 +08:00
|
|
|
/>
|
|
|
|
|
|
|
|
```
|
|
|
|
```js
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
time0: null,
|
|
|
|
time1: 1563937380000
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
disabledHours (hour) {
|
|
|
|
return hour>13 && hour<16
|
|
|
|
},
|
|
|
|
disabledMinutes (minute, selectedHour) {
|
|
|
|
if(Number(selectedHour) === 17) {
|
2019-12-04 11:05:05 +08:00
|
|
|
return minute >=0 && minute < 9
|
|
|
|
} else {
|
|
|
|
return false
|
2019-11-29 15:24:37 +08:00
|
|
|
}
|
|
|
|
},
|
2019-12-04 11:05:05 +08:00
|
|
|
disabledSeconds (second, selectedMinute, selectedHour) {
|
2019-11-29 15:24:37 +08:00
|
|
|
if(Number(selectedHour) === 17 && Number(selectedMinute) === 10) {
|
|
|
|
return second > 13 && second < 40
|
2019-12-04 11:05:05 +08:00
|
|
|
} else {
|
|
|
|
return false
|
2019-11-29 15:24:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
```css
|
|
|
|
.n-time-picker {
|
|
|
|
margin: 0 12px 8px 0;
|
|
|
|
}
|
|
|
|
```
|