表单提交可滚动到错误块

This commit is contained in:
icssoa
2025-08-11 23:48:33 +08:00
parent ce6faa84d4
commit 93be8d8b5d
2 changed files with 3 additions and 2 deletions

View File

@@ -15,7 +15,7 @@
<script setup lang="ts">
import { computed, getCurrentInstance, nextTick, ref, watch, type PropType } from "vue";
import { isEmpty, isString, parsePt, parseToObject } from "@/cool";
import { isEmpty, isNull, isString, parsePt, parseToObject } from "@/cool";
import type { ClFormLabelPosition, ClFormRule, ClFormValidateError } from "../../types";
import { $t, t } from "@/locale";
import { usePage } from "../../hooks";
@@ -297,7 +297,7 @@ function scrollToError(prop: string) {
.in(component)
.select(".cl-form-item--error")
.boundingClientRect((res) => {
if (res != null) {
if (!isNull(res)) {
page.scrollTo(((res as NodeInfo).top ?? 0) + page.getScrollTop());
}
})