From 8aa7dabeff82290daf96dad4eb803a5f2b6d19bf Mon Sep 17 00:00:00 2001 From: Netfan Date: Mon, 28 Apr 2025 23:20:33 +0800 Subject: [PATCH] fix: calculation for collapsing search form is incorrect while initially hidden (#6068) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复当默认隐藏搜索表单时,折叠位置的计算不正确的问题 --- .../@core/ui-kit/form-ui/src/form-render/expandable.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/@core/ui-kit/form-ui/src/form-render/expandable.ts b/packages/@core/ui-kit/form-ui/src/form-render/expandable.ts index a7b8ef41..9383064c 100644 --- a/packages/@core/ui-kit/form-ui/src/form-render/expandable.ts +++ b/packages/@core/ui-kit/form-ui/src/form-render/expandable.ts @@ -2,13 +2,18 @@ import type { FormRenderProps } from '../types'; import { computed, nextTick, onMounted, ref, useTemplateRef, watch } from 'vue'; -import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'; +import { + breakpointsTailwind, + useBreakpoints, + useElementVisibility, +} from '@vueuse/core'; /** * 动态计算行数 */ export function useExpandable(props: FormRenderProps) { const wrapperRef = useTemplateRef('wrapperRef'); + const isVisible = useElementVisibility(wrapperRef); const rowMapping = ref>({}); // 是否已经计算过一次 const isCalculated = ref(false); @@ -31,6 +36,7 @@ export function useExpandable(props: FormRenderProps) { () => props.showCollapseButton, () => breakpoints.active().value, () => props.schema?.length, + () => isVisible.value, ], async ([val]) => { if (val) {