From 57314ee1d08a24dac7271b7e9f9438bbe4d52917 Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 10 Oct 2023 12:12:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ScrollContainer=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Container/src/ScrollContainer.vue | 11 ++++++- .../Modal/src/components/ModalWrapper.vue | 8 ++--- src/components/Scrollbar/src/Scrollbar.vue | 32 +++++++++++++------ 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/components/Container/src/ScrollContainer.vue b/src/components/Container/src/ScrollContainer.vue index 4aaa25d3..2f955e47 100644 --- a/src/components/Container/src/ScrollContainer.vue +++ b/src/components/Container/src/ScrollContainer.vue @@ -6,6 +6,10 @@ import { useScrollTo } from '@/hooks/event/useScrollTo' defineOptions({ name: 'ScrollContainer' }) +defineProps({ + scrollHeight: { type: Number }, +}) + const scrollbarRef = ref>(null) /** @@ -72,7 +76,12 @@ defineExpose({ scrollbarRef, scrollTo, scrollBottom, getScrollWrap }) diff --git a/src/components/Modal/src/components/ModalWrapper.vue b/src/components/Modal/src/components/ModalWrapper.vue index 705d7c1b..e8c7bef9 100644 --- a/src/components/Modal/src/components/ModalWrapper.vue +++ b/src/components/Modal/src/components/ModalWrapper.vue @@ -26,7 +26,7 @@ const spinRef = ref(null) const realHeightRef = ref(0) const minRealHeightRef = ref(0) -let realHeight = 0 +const realHeight = ref(0); const stopElResizeFn: Fn = () => {} @@ -122,13 +122,13 @@ async function setModalHeight() { return await nextTick() // if (!realHeight) { - realHeight = spinEl.scrollHeight + realHeight.value = spinEl.scrollHeight // } if (props.fullScreen) realHeightRef.value = window.innerHeight - props.modalFooterHeight - props.modalHeaderHeight - 28 else - realHeightRef.value = props.height ? props.height : realHeight > maxHeight ? maxHeight : realHeight + realHeightRef.value = props.height ? props.height : realHeight.value > maxHeight ? maxHeight : realHeight.value emit('heightChange', unref(realHeightRef)) } @@ -141,7 +141,7 @@ defineExpose({ scrollTop })