Uniapp External Navigation: Complete Guide
To navigate to an external page in uniapp, you can use either uni.navigateToMiniProgram or uni.navigateTo method.
- uni.navigateToMiniProgram: Used to navigate to a page of another mini program, requires passing the appId and path parameters of the mini program.
uni.navigateToMiniProgram({
appId: '其他小程序的AppID',
path: '其他小程序的页面路径',
success: function () {
console.log('跳转成功');
}
});
- uni.navigateTo: Used to navigate to a regular external link page, requiring the url parameter to be passed.
uni.navigateTo({
url: 'http://www.example.com',
success: function () {
console.log('跳转成功');
}
});
Choose the appropriate method based on specific requirements to achieve the function of jumping to an external page in Uniapp.