diff --git a/src/components/common/VnInputTime.vue b/src/components/common/VnInputTime.vue index 9344ff869..e2c6ffb56 100644 --- a/src/components/common/VnInputTime.vue +++ b/src/components/common/VnInputTime.vue @@ -2,6 +2,7 @@ import { watch, computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { date } from 'quasar'; +import { nextTick } from 'vue'; const model = defineModel({ type: String }); const props = defineProps({ @@ -55,17 +56,24 @@ const formattedTime = computed({ function dateToTime(newDate) { return date.formatDate(new Date(newDate), dateFormat); } - +const timeField = ref(); watch( () => model.value, (val) => (formattedTime.value = val), { immediate: true } ); +const focusField = () => { + nextTick(() => { + const input = timeField.value.$el.querySelector('input'); + input.setSelectionRange(0, 0); + }); +};