naive-ui/demo/documentation/components/timePicker/enUS/disabledTime.md
2019-12-23 17:20:13 +08:00

828 B

Disabled Time

<n-time-picker
  v-model="time0"
  :hourDisabled="disabledHours"
  :minuteDisabled="disabledMinutes"
  :secondDisabled="disabledSeconds"
/>

export default {
  data () {
    return {
      time0: null,
      time1: 1563937380000,
    }
  },
  methods: {
    disabledHours (hour) {
      return hour > 13 && hour < 16
    },
    disabledMinutes (minute, selectedHour) {
      if (Number(selectedHour) === 17) {
        return minute >= 0 && minute < 9
      } else {
        return false
      }
    },
    disabledSeconds (second, selectedMinute, selectedHour) {
      if (Number(selectedHour) === 17 && Number(selectedMinute) === 10) {
        return second > 13 && second < 40
      } else {
        return false
      }
    },
  },
}
.n-time-picker {
  margin: 0 12px 8px 0;
}