提交 ee4d54c2 编写于 作者: H hdx

long-list: 调整停止下拉刷新逻辑

上级 233edb64
...@@ -99,15 +99,12 @@ ...@@ -99,15 +99,12 @@
} }
}, },
methods: { methods: {
refreshData() { refreshData(loadComplete : (() => void) | null) {
this.dataList.length = 0 this.dataList.length = 0
this.$currentPage = 1 this.$currentPage = 1
this.loadData(() => { this.loadData(loadComplete)
// TODO
uni.stopPullDownRefresh()
})
}, },
loadData(oncomplete : (() => void) | null) { loadData(loadComplete : (() => void) | null) {
if (this.loading || this.isEnded) { if (this.loading || this.isEnded) {
return return
} }
...@@ -139,8 +136,8 @@ ...@@ -139,8 +136,8 @@
}, },
complete: () => { complete: () => {
this.loading = false this.loading = false
if (oncomplete != null) { if (loadComplete != null) {
oncomplete() loadComplete()
} }
} }
}) })
......
...@@ -98,7 +98,9 @@ ...@@ -98,7 +98,9 @@
this.setSwiperIndex(0, true) this.setSwiperIndex(0, true)
}, },
onPullDownRefresh() { onPullDownRefresh() {
(this.$refs["longPage"]! as ComponentPublicInstance[])[this.swiperIndex].$callMethod('refreshData') (this.$refs["longPage"]! as ComponentPublicInstance[])[this.swiperIndex].$callMethod('refreshData', () => {
uni.stopPullDownRefresh()
})
}, },
methods: { methods: {
// TODO // TODO
...@@ -210,7 +212,7 @@ ...@@ -210,7 +212,7 @@
initSwiperItemData(index : number) { initSwiperItemData(index : number) {
if (!this.swiperList[index].preload) { if (!this.swiperList[index].preload) {
this.swiperList[index].preload = true; this.swiperList[index].preload = true;
(this.$refs["longPage"]! as ComponentPublicInstance[])[index].$callMethod('loadData') (this.$refs["longPage"]! as ComponentPublicInstance[])[index].$callMethod('loadData', null)
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册