uni-app 不用onShow返回上一页刷新数据

onShow:刷新太频繁,性能不好

$on、$emit
列表页(上一个页面):

	onLoad() {
			uni.$on('refreshData', () => {
				this.getList();
			})
		},

详情页(当前页面):修改列表后返回上一个页面

                    this.$refs.uToast.show({
						message: "修改成功",
						type: "success",
						complete() {
							uni.$emit('refreshData');
							uni.navigateBack(1)
						}
					})

猜你喜欢

转载自blog.csdn.net/Stitch_xiao/article/details/128655435