直接列表放法调用的话每次进来会刷新2次,性能不好
列表使用的是z-paging
详情页操作完返回
uni.showToast({
title: '操作完成',
icon: 'none',
duration: 2000,
});
uni.navigateBack(1)
在列表页中的data定义
data() {
return {
pageNo: null,
pageSize: null,
}
}
在onShow中
onShow() {
if (this.pageNo && this.pageSize) {
this.$nextTick(function() {
this.$refs.paging.refresh()
})
}
},
在queryList方法中重置pageNo,pageSize
queryList(pageNo, pageSize) {
this.pageNo = pageNo
this.pageSize = pageSize
const params = {
pageNo: pageNo,
pageSize: pageNo,
}
this.isLoading = true
xxxxxx(params).then(res => {
this.isLoading = false
if (res.data.data.records.length > 0) {
this.$refs.paging.completeByTotal(res.data.data.records, res.data.data.total);
}
})
}
完成详情页面返回后刷新列表