From 96d45e39c3e7fb5f8a28d3fe24a52ecc03217dce Mon Sep 17 00:00:00 2001 From: BeADre Date: Tue, 30 Mar 2021 22:15:15 +0800 Subject: [PATCH] fix(time-picker): fix some bugs --- .../varlet-ui/src/time-picker/TimePicker.vue | 84 ++++++------ packages/varlet-ui/src/time-picker/clock.vue | 123 +++++++++++++----- .../src/time-picker/example/index.vue | 8 +- packages/varlet-ui/src/time-picker/utils.ts | 6 +- 4 files changed, 138 insertions(+), 83 deletions(-) diff --git a/packages/varlet-ui/src/time-picker/TimePicker.vue b/packages/varlet-ui/src/time-picker/TimePicker.vue index 0defdc0a86e..6b1458cbac4 100644 --- a/packages/varlet-ui/src/time-picker/TimePicker.vue +++ b/packages/varlet-ui/src/time-picker/TimePicker.vue @@ -91,6 +91,7 @@ import dayjs from 'dayjs' import Clock from './clock.vue' import { props, Time, AmPm, hoursAmpm, hours24 } from './props' import { toNumber } from '../utils/shared' +import { nextTickFrame } from '../utils/elements' import { getNumberTime, getIsDisableMinute, getIsDisableSecond } from './utils' export default defineComponent({ @@ -104,13 +105,20 @@ export default defineComponent({ const inner: Ref = ref(null) const isInner: Ref = ref(false) const isActualInner: Ref = ref(false) - const hourRad: Ref = ref(0) + const isChosenUsableHour: Ref = ref(false) + const isChosenUsableMinute: Ref = ref(false) + const hourRad: Ref = ref(undefined) const minuteRad: Ref = ref(0) const secondRad: Ref = ref(0) const type: Ref = ref('hour') const ampm: Ref = ref('am') const isDisableHour: Ref = ref(false) const isDisableMinute: Ref = ref(false) + const time: Ref