提交 ee4d54c2 编写于 作者: H hdx

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

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