vue返回上一页并传值回上一个页面(uni版本)

1.返回上一页点击按钮及配置参数

backNav()  {
	uni.$emit("planAdd",{tabIndex: 2});
	uni.navigateBack();   //此地方用的是uni的返回上一页方法,如需其他的返回方法请进行相对应替换
},

2.页面接收参数(在onShow里)

onShow(){
	let that = this;
	uni.$on("planAdd", res => {
	    console.log(res);
		let tabIndex = res.tabIndex
		// 清除监听
		uni.$off('planAdd');
	})
},

猜你喜欢

转载自blog.csdn.net/qq_35181466/article/details/115691844