提交 b5a3307b 编写于 作者: S shutao

更新scroll-view-refresher示例

上级 ff75f65c
<template> <template>
<view class="container"> <view class="container">
<page-head title="scroll-view 下拉刷新"></page-head> <page-head title="scroll-view 下拉刷新"></page-head>
<scroll-view class="scroll" refresher-enabled = true @refresherrefresh="onRefresherrefresh" :refresher-triggered = "refresherTriggered"> <scroll-view class="scroll" refresher-enabled = true :refresher-triggered = "refresherTriggered"
@refresherrefresh="onRefresherrefresh" @refresherabort="onRefresherabort" @refresherrestore="onRefresherrestore"
@refresherpulling="onRefresherpulling" @scrolltolower="onScrolltolower">
<view v-for="key in scrollData" :key="key"> <view v-for="key in scrollData" :key="key">
<view class="scroll-item"> <view class="scroll-item">
<text class="scroll-item-title">{{key}}</text> <text class="scroll-item-title">{{key}}</text>
...@@ -10,8 +12,8 @@ ...@@ -10,8 +12,8 @@
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
<script> <script>
import RefresherEvent from 'io.dcloud.uniapp.runtime.RefresherEvent';
export default { export default {
data() { data() {
...@@ -29,13 +31,25 @@ import RefresherEvent from 'io.dcloud.uniapp.runtime.RefresherEvent'; ...@@ -29,13 +31,25 @@ import RefresherEvent from 'io.dcloud.uniapp.runtime.RefresherEvent';
}, },
methods: { methods: {
onRefresherrefresh(e: RefresherEvent) { onRefresherrefresh(e: RefresherEvent) {
console.log("onRefresherrefresh--------------下拉刷新触发") console.log("onRefresherrefresh--------------下拉刷新触发")
this.refresherTriggered = true this.refresherTriggered = true
setTimeout(function(){ setTimeout(function(){
this.refresherTriggered = false this.refresherTriggered = false
}, 1500) }, 1500)
},
onRefresherabort(e: RefresherEvent) {
console.log("onRefresherabort------下拉刷新被中止")
},
onRefresherrestore(e: RefresherEvent) {
console.log("onRefresherrestore------下拉刷新被复位")
},
onRefresherpulling(e: RefresherEvent) {
console.log("onRefresherrestore------拉刷新控件被下拉-dy="+e.detail.dy)
},
onScrolltolower(e: ScrollToLowerEvent) {
console.log("onScrolltolower 滚动到底部-----"+e.detail.direction)
} }
} }
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册