fix: refs #8441 handle blur and focusout events to format date input
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
83ecfca6b8
commit
31e337c77b
|
@ -141,6 +141,16 @@ const formatDate = () => {
|
|||
textColor.value = '';
|
||||
};
|
||||
|
||||
const didFormat = ref(false);
|
||||
|
||||
const handleBlurOrFocusout = (e) => {
|
||||
if (!didFormat.value) {
|
||||
formatDate();
|
||||
didFormat.value = true;
|
||||
nextTick(() => (didFormat.value = false));
|
||||
}
|
||||
};
|
||||
|
||||
const handleEnter = (event) => {
|
||||
formatDate();
|
||||
|
||||
|
@ -170,7 +180,8 @@ const handleEnter = (event) => {
|
|||
:input-style="{ color: textColor }"
|
||||
@click="isPopupOpen = !isPopupOpen"
|
||||
@keydown="isPopupOpen = false"
|
||||
@blur="formatDate"
|
||||
@blur="handleBlurOrFocusout"
|
||||
@focusout="handleBlurOrFocusout"
|
||||
@keydown.enter.prevent="handleEnter"
|
||||
hide-bottom-space
|
||||
:data-cy="($attrs['data-cy'] ?? $attrs.label) + '_inputDate'"
|
||||
|
|
Loading…
Reference in New Issue