From 3cef9ccc7254bfdf30d9ebece1c4cdbe81606fcb Mon Sep 17 00:00:00 2001 From: ericjyang Date: Tue, 24 May 2022 09:40:34 +0800 Subject: [PATCH] fix(backtop): add toTop event --- src/back-top/_example/back-top.ts | 4 ++++ src/back-top/_example/back-top.wxml | 3 ++- src/back-top/back-top.ts | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/back-top/_example/back-top.ts b/src/back-top/_example/back-top.ts index 1b9c47e1a..53e08be00 100644 --- a/src/back-top/_example/back-top.ts +++ b/src/back-top/_example/back-top.ts @@ -46,4 +46,8 @@ Page({ this.setData({ backTopDemo: backTopDemos[index] }); wx.pageScrollTo({ duration: 300, scrollTop: 1000 }); }, + + onToTop(e: any) { + console.log('backToTop', e); + }, }); diff --git a/src/back-top/_example/back-top.wxml b/src/back-top/_example/back-top.wxml index 04ac6e01c..1aee3983b 100644 --- a/src/back-top/_example/back-top.wxml +++ b/src/back-top/_example/back-top.wxml @@ -52,6 +52,7 @@ - + + diff --git a/src/back-top/back-top.ts b/src/back-top/back-top.ts index b535cf81d..b962418cc 100644 --- a/src/back-top/back-top.ts +++ b/src/back-top/back-top.ts @@ -26,6 +26,7 @@ export default class BackTop extends SuperComponent { * Component methods */ toTop() { + this.triggerEvent('toTop'); wx.pageScrollTo({ scrollTop: 0, duration: 300,