https://ask.dcloud.net.cn/article/36010
列表返回刷新列表
onLoad (option) {
// 监听事件
uni.$on('resetServiceList', () => {
console.log('执行刷新resetServiceList')
this.getUpdateData()
})
}
onUnload () {
uni.$off('resetServiceList')
console.log('卸载resetServiceList')
},
getUpdateData () {
const params = {
pageNum: 1,
pageSize: this.params.pageNum * this.params.pageSize
}
Object.assign(params, { flag: this.active, shopId: this.shopId })
servicesList(params).then(res => {
res.rows.forEach(item => {
item.show = false
})
this.list = res.rows
this.total = res.total
if (this.total === this.list.length) {
this.status = 'nomore'
} else {
this.status = 'loading'
}
})
}
其他页面返回上一页面时
uni.$emit('resetServiceList', {})