uniapp 自定义返回逻辑

在使用uniapp返回键的时候我们发现,返回键的逻辑是根据历史记录返回上一页面
办他

onBackPress() {
    
    
			uni.navigateTo({
    
    
			        url: "../home",
			    });
		  return true
	},

		//返回主页面使用
		uni.switchTab({
    
    
			url: "../home"
		});
		//其他方法见官网

https://uniapp.dcloud.io/api/router?id=navigateto
返回true,执行自定义逻辑,
希望对你有所帮助

猜你喜欢

转载自blog.csdn.net/qq_44977477/article/details/104966288