提交 a20ee298 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

修复 下拉刷新示例报错的问题

上级 26963d83
...@@ -3,7 +3,9 @@ import App from './App.uvue' ...@@ -3,7 +3,9 @@ import App from './App.uvue'
import { createSSRApp } from 'vue' import { createSSRApp } from 'vue'
export function createApp() { export function createApp() {
const app = createSSRApp(App) const app = createSSRApp(App)
app.config.errorHandler = (err, vm, info) => {
console.log(err, vm, info)
}
app.mixin({ app.mixin({
onReady() { onReady() {
setTimeout(() => { setTimeout(() => {
......
<template> <template>
<scroll-view style="flex:1;" :refresher-enabled="true" :refresher-triggered="refresherTriggered" <scroll-view style="flex:1;" :refresher-enabled="true" :refresher-triggered="refresherTriggered"
refresher-default-style="none" @refresherpulling="onRefresherpulling" @refresherrefresh="onRefresherrefresh"> refresher-default-style="none" @refresherpulling="onRefresherpulling" @refresherrefresh="onRefresherrefresh" @refresherrestore="onRefreshrestore">
<view style="height: 25px;"></view> <view style="height: 25px;"></view>
<view v-for="i in 20" class="content-item"> <view v-for="i in 20" class="content-item">
<text class="text">item-{{i}}</text> <text class="text">item-{{i}}</text>
...@@ -38,9 +38,6 @@ ...@@ -38,9 +38,6 @@
methods: { methods: {
onRefresherpulling(e : RefresherEvent) { onRefresherpulling(e : RefresherEvent) {
this.pullingDistance = e.detail.dy; this.pullingDistance = e.detail.dy;
if (this.pullingDistance.toDouble() == 0.0) {
this.resetting = false;
}
}, },
onRefresherrefresh() { onRefresherrefresh() {
this.refresherTriggered = true this.refresherTriggered = true
...@@ -48,7 +45,11 @@ ...@@ -48,7 +45,11 @@
this.refresherTriggered = false this.refresherTriggered = false
this.resetting = true; this.resetting = true;
}, 1500) }, 1500)
}, },
onRefreshrestore() {
this.pullingDistance = 0
this.resetting = false;
}
} }
} }
</script> </script>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
:refresher-enabled="true" :refresher-triggered="refresherTriggered" refresher-default-style="none" :refresher-enabled="true" :refresher-triggered="refresherTriggered" refresher-default-style="none"
@refresherpulling="onRefresherpulling" @refresherpulling="onRefresherpulling"
@refresherrefresh="onRefresherrefresh" @refresherrefresh="onRefresherrefresh"
@refresherrestore="onRefreshrestore"
:refresher-threshold="refresherThreshold" :refresher-threshold="refresherThreshold"
> >
<view v-for="i in 20" class="content-item"> <view v-for="i in 20" class="content-item">
...@@ -43,9 +44,6 @@ ...@@ -43,9 +44,6 @@
onRefresherpulling(e:RefresherEvent){ onRefresherpulling(e:RefresherEvent){
// console.log('onRefresherpulling',e.detail.dy) // console.log('onRefresherpulling',e.detail.dy)
this.pullingDistance = e.detail.dy this.pullingDistance = e.detail.dy
if (this.pullingDistance.toDouble() == 0.0) {
this.resetting = false;
}
}, },
onRefresherrefresh(){ onRefresherrefresh(){
this.refresherTriggered = true this.refresherTriggered = true
...@@ -53,12 +51,10 @@ ...@@ -53,12 +51,10 @@
this.refresherTriggered = false this.refresherTriggered = false
},1500) },1500)
}, },
// onRefresherrestore(e:RefresherEvent){ onRefreshrestore() {
// console.log('onRefresherrestore',e) this.pullingDistance = 0
// }, this.resetting = false;
// onRefresherabort(e:RefresherEvent){ }
// console.log('onRefresherabort',e)
// },
} }
} }
</script> </script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册