From 436b06fee1b11a6a606508147ec191755fd8f394 Mon Sep 17 00:00:00 2001
From: icssoa <615206459@qq.com>
Date: Fri, 17 Oct 2025 23:21:37 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20offScroll=20=E6=96=B9?=
=?UTF-8?q?=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cool/scroller/index.ts | 10 ++++++++++
.../components/cl-back-top/cl-back-top.uvue | 14 +++++++++-----
uni_modules/cool-ui/hooks/page.ts | 8 ++++++++
3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/cool/scroller/index.ts b/cool/scroller/index.ts
index 39f7732..7504ad5 100644
--- a/cool/scroller/index.ts
+++ b/cool/scroller/index.ts
@@ -18,6 +18,16 @@ class Scroller {
cbs.push(callback);
this.list.set(path, cbs);
}
+
+ // 取消监听页面滚动
+ off = (callback: (top: number) => void) => {
+ const path = router.path();
+ const cbs = this.list.get(path) ?? [];
+ this.list.set(
+ path,
+ cbs.filter((cb) => cb != callback)
+ );
+ };
}
export const scroller = new Scroller();
diff --git a/uni_modules/cool-ui/components/cl-back-top/cl-back-top.uvue b/uni_modules/cool-ui/components/cl-back-top/cl-back-top.uvue
index 2cf504a..2626e8f 100644
--- a/uni_modules/cool-ui/components/cl-back-top/cl-back-top.uvue
+++ b/uni_modules/cool-ui/components/cl-back-top/cl-back-top.uvue
@@ -13,7 +13,7 @@