From 4d023a7c7c5e5ed6b50277205ee6619d1413509a Mon Sep 17 00:00:00 2001 From: puriphatt Date: Wed, 30 Apr 2025 16:15:08 +0700 Subject: [PATCH] feat: add smooth scrolling on validation error for forms --- src/components/DialogForm.vue | 10 ++++++++++ src/components/DrawerInfo.vue | 10 ++++++++++ src/components/dialog/DialogFormContainer.vue | 10 ++++++++++ src/pages/02_personnel-management/MainPage.vue | 1 - 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/components/DialogForm.vue b/src/components/DialogForm.vue index 84319bcf..fb29a4ca 100644 --- a/src/components/DialogForm.vue +++ b/src/components/DialogForm.vue @@ -42,6 +42,15 @@ defineProps<{ const modal = defineModel('modal', { default: false }); const currentTab = defineModel('currentTab'); + +async function onValidationError(ref: any) { + const el = ref.$el as Element; + el.scrollIntoView({ + behavior: 'smooth', + block: 'center', + inline: 'nearest', + }); +}