基础库 2.7.20 或更高版本,建议使用 my.ap.openURL
进行跳转,案例如下:
my.ap.openURL({url: 'https://render.alipay.com/p/404',success: (res) => {my.showToast({type: 'success',content: '跳转成功',duration: 3000,});},fail: (err) => {my.showToast({type: 'exception',content: '跳转失败',duration: 3000,});}
});
基础库较低的版本,如 1.25.4,openURL 跳不了,建议用 my.ap.navigateToAlipayPage
进行跳转,案例如下:
my.ap.navigateToAlipayPage({path: 'https://render.alipay.com/p/404',success: (res) => {my.showToast({type: 'success',content: '跳转成功',duration: 3000,});},fail: (err) => {my.showToast({type: 'exception',content: '跳转失败',duration: 3000,});}
});