0
0
Fork 0

feat: curso in start when is 00:00

This commit is contained in:
Alex Moreno 2024-07-16 12:13:16 +02:00
parent f01e6d74f8
commit 4f36a78681
1 changed files with 7 additions and 3 deletions

View File

@ -72,15 +72,18 @@ watch(
watch( watch(
() => formattedTime.value, () => formattedTime.value,
async (val) => { async (val) => {
let position = 3;
const input = inputRef.value?.getNativeElement(); const input = inputRef.value?.getNativeElement();
if (!val || !input) return; if (!val || !input) return;
const [hh, mm] = val.split(':'); let [hh, mm] = val.split(':');
if (parseInt(hh) >= 10 || mm != '00') return; hh = parseInt(hh);
if (hh >= 10 || mm != '00') return;
await nextTick(); await nextTick();
await nextTick(); await nextTick();
input.setSelectionRange(3, 3); if (!hh) position = 0;
input.setSelectionRange(position, position);
}, },
{ immediate: true } { immediate: true }
); );
@ -99,6 +102,7 @@ watch(
style="min-width: 100px" style="min-width: 100px"
:rules="$attrs.required ? [requiredFieldRule] : null" :rules="$attrs.required ? [requiredFieldRule] : null"
@click="isPopupOpen = false" @click="isPopupOpen = false"
@focus="inputRef.getNativeElement().setSelectionRange(0, 0)"
> >
<template #append> <template #append>
<QIcon <QIcon