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