Alipay applet page jump - openURL, navigateToAlipayPage

Basic library version 2.7.20 or later, it is recommended to use my.ap.openURLto jump, the case is as follows:

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,
		    });
		}
});

For a lower version of the basic library, such as 1.25.4, openURL cannot jump, it is recommended to use my.ap.navigateToAlipayPageto jump, the case is as follows:

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,
		    });
		}
});

Guess you like

Origin blog.csdn.net/m0_54355172/article/details/131944286