#6917 - inputDate_inputTime_improviments #552

Merged
alexm merged 8 commits from 6917-inputDate_inputTime_improviments into test 2024-07-16 11:12:55 +00:00
1 changed files with 7 additions and 3 deletions
Showing only changes of commit 4f36a78681 - Show all commits

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;
Review

Porque hay 2?

Porque hay 2?
Review

Con 1 no funcionaba entiendo que vue aún no ha actualizado el valor con 1 solo

Con 1 no funcionaba entiendo que vue aún no ha actualizado el valor con 1 solo
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