列表优化
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
export default {
|
||||
onPullDownRefresh() {
|
||||
this.store && this.store.reload()
|
||||
this.store.loadedCallback = () => {
|
||||
uni.stopPullDownRefresh()
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.store.status != 'noMore') {
|
||||
@@ -20,7 +17,7 @@ export default {
|
||||
var me = this
|
||||
return {
|
||||
data: [],
|
||||
status: 'more',
|
||||
status: 'noMore',
|
||||
empty: false,
|
||||
total: 0,
|
||||
header: {
|
||||
@@ -35,9 +32,8 @@ export default {
|
||||
firstCallBack: null,
|
||||
loadedCallback: null,
|
||||
reload() {
|
||||
if(this.status == 'loading') return
|
||||
if (this.status == 'loading') return
|
||||
this.data = []
|
||||
this.status = 'loading'
|
||||
this.empty = false
|
||||
this.params.pageNum = 1
|
||||
this.next()
|
||||
@@ -50,6 +46,7 @@ export default {
|
||||
}, 300)
|
||||
},
|
||||
next() {
|
||||
this.status = 'loading'
|
||||
me.$request({
|
||||
url: url,
|
||||
data: this.params,
|
||||
@@ -68,14 +65,17 @@ export default {
|
||||
this.status = 'noMore'
|
||||
} else if (res.total == resultData.length) {
|
||||
this.status = 'noMore'
|
||||
} else {
|
||||
this.status = 'more'
|
||||
}
|
||||
} else {
|
||||
this.data.push(...resultData)
|
||||
if (resultData.length < this.params.pageSize) {
|
||||
this.status = 'noMore'
|
||||
} else {
|
||||
this.status = 'more'
|
||||
}
|
||||
}
|
||||
|
||||
if (this.params.pageNum == 1) {
|
||||
this.firstCallBack && this.firstCallBack()
|
||||
}
|
||||
@@ -83,6 +83,7 @@ export default {
|
||||
this.params.pageNum++
|
||||
this.total = res.total
|
||||
this.loading = false
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user