From 2ed6adc6740053c01d07e67bcbfae749d271867d Mon Sep 17 00:00:00 2001 From: Hooray Hu <304327508@qq.com> Date: Thu, 27 Jun 2024 16:27:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20PageLayout=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20reachTop=20=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PageLayout/index.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/PageLayout/index.vue b/src/components/PageLayout/index.vue index 6ab87e1..eb33f6e 100644 --- a/src/components/PageLayout/index.vue +++ b/src/components/PageLayout/index.vue @@ -27,6 +27,7 @@ withDefaults( const emits = defineEmits<{ scroll: [Event] + reachTop: [] reachBottom: [] }>() @@ -42,6 +43,9 @@ function handleMainScroll(e: Event) { handleTabbarScroll() handleBackTopScroll() emits('scroll', e) + if ((e.target as HTMLElement).scrollTop === 0) { + emits('reachTop') + } if (Math.ceil((e.target as HTMLElement).scrollTop + (e.target as HTMLElement).clientHeight) >= (e.target as HTMLElement).scrollHeight) { emits('reachBottom') }