SoFunction
Updated on 2025-03-03

Example of code jump between WeChat applet and H5 pages

This article mainly introduces the example code examples of the mutual jump between WeChat mini program and H5 page. The example code is introduced in this article in detail, which has certain reference value for everyone's learning or work. Friends who need it can refer to it.

1. WeChat applet jump to applet

// Mini program jump/*
 * appId string is the applet to be opened appId
 * path string No Open page path, if empty, open the home page
 * extraData object No Data that needs to be passed to the target applet. The target applet can obtain this data in , .	
 * envVersion string release No applet version to open.  This parameter is valid only when the current applet is in the development or trial version.  If the current applet is the official version, the open applet must be the official version.  (Develop development board trial trial version release official version)
 * success function No The callback function that the interface calls successfully
 * fail function No The callback function that failed to call the interface
 * complete function No Callback function that ends the interface call (the call will be executed if it is successful or failed)
 */
navigateToMiniProgram(mAppId)
{
({
appId: mAppId,
path: 'page/index/index?id=123',
extraData: {
foo: 'bar'
},
envVersion: 'release',
success(res) {
// Open successfullyret_handler(res);
},
fail(res) {
}
})
},

2.h5 jump to applet

// Click to experience now and jump to the mini program$('.experience').click(function () {
({
url: '/pages/index/index',
});
})

The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.