preface

Small programs and small programs can jump between each other to form a flow cycle. How do you do that in a small program

Applets provide two ways to realize the jump between applets

Mode 1- Use API mode to jump

See the sample code below

<<view class="container">
  <view bindtap="onJumpMin"> Open jump to other small program mode 1</view></view>
Copy the code

Here is the logical code

onJumpMin() {
    wx.navigateToMiniProgram({
      appId: 'wx9fbad659d526c9bc'// Need to jump to the specified applet appid      path: 'pages/home/home'// Open the page      envVersion: 'release'. success(res) { // Open successfully console.log(res);  }  })  } Copy the code

The API to jump to using applets is just a few lines above

Mode 2- Use the label mode to jump

Here is the WXML code

<view>
  <navigator
    target="miniProgram"
    open-type="navigate"
    app-id="wx66d9cf3762c49a1a"
 path="pages/index/index"  version="release" > open the bound applet </navigator > </view> Copy the code

Use tag to jump, very simple, just need to WXML with target,open-type,app-id,path, specify the corresponding parameters can be realized jump

prompt

  • The jump cannot be realized in the simulator, please scan code on the real machine to preview the test

  • No need to declare the jump list, no limit on the number of jumps (under test)

Since April 24, 2020, using other small program function will not need to jump in the global configuration statement jump list, call the interface will no longer check whether the AppID jump in navigateToMiniProgramAppIdList. From April 24, 2020, the number of jump to other small programs will no longer be limited, please pay attention to comply with the operation specifications when using this function.

In older applets, you need to set the whitelist in the app.json global configuration, as shown below

"navigateToMiniProgramAppIdList": [
    "wx9fbad659d526c9bc".    "wx66d9cf3762c49a1a"
].Copy the code

There is no limit on the number of jumps before small programs and small programs, no doubt to improve the traffic between small programs and small programs, increase the activity of small programs, but we still need to pay attention to the operation specifications of small program jumps to avoid mines

The related documents

  • Applet API mode jump
  • Jump to a small program label
  • https://coder.itclan.cn/- Applet Jump to applet