Skip to content

Commit

Permalink
Merge pull request #460 from JJunYang/fix/backTop-event
Browse files Browse the repository at this point in the history
fix(backtop): add toTop event
  • Loading branch information
LeeJim committed May 24, 2022
2 parents ee4c276 + 3cef9cc commit 74100e1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/back-top/_example/back-top.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ Page({
this.setData({ backTopDemo: backTopDemos[index] });
wx.pageScrollTo({ duration: 300, scrollTop: 1000 });
},

onToTop(e: any) {
console.log('backToTop', e);
},
});
3 changes: 2 additions & 1 deletion src/back-top/_example/back-top.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<t-skeleton rowCol="{{rowCol3}}" class="skeleton-item" t-class-text="skeleton-text" loading></t-skeleton>
</view>

<t-back-top wx:if="{{showBackTop}}" theme="{{backTopDemo.theme}}" text="{{backTopDemo.text}}"> </t-back-top>
<t-back-top wx:if="{{showBackTop}}" theme="{{backTopDemo.theme}}" text="{{backTopDemo.text}}" bindtoTop="onToTop">
</t-back-top>
</t-demo>
</view>
1 change: 1 addition & 0 deletions src/back-top/back-top.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default class BackTop extends SuperComponent {
* Component methods
*/
toTop() {
this.triggerEvent('toTop');
wx.pageScrollTo({
scrollTop: 0,
duration: 300,
Expand Down

0 comments on commit 74100e1

Please sign in to comment.