如果页面栈为空则返回失败

This commit is contained in:
wangxiaowei
2025-12-26 14:46:10 +08:00
parent c42e4af2bd
commit 54a850fd66

View File

@ -28,11 +28,19 @@ export const router = {
//返回上页面 //返回上页面
navigateBack: (delta: number = 1, time = 0) => { navigateBack: (delta: number = 1, time = 0) => {
return new Promise<void>((resolve, reject) => {
setTimeout(function() { setTimeout(function() {
uni.navigateBack({ uni.navigateBack({
delta delta,
success: () => {
resolve();
},
fail: (err) => {
reject(err);
}
}) })
}, time); }, time);
});
}, },
//关闭所有页面,打开到应用内的某个页面 //关闭所有页面,打开到应用内的某个页面