Navigation Skip micro letter applet

Declarative navigation

1. Navigate to non tabBar page

Non-tabBar page refers not be treated as tabBar to switch pages.

Sample code:

<Navigator url = 'pages / info / info'> Click-to </ navigator>

 The code above uses the url attribute to jump to top of page path, where Page path should begin with a /, and the path must declare in advance in the pages node app.json in order to achieve a normal jump.

 

2. Navigate to the page tabBar

tabBar page refers to the page switching is performed as tabBar page. If the navigator component simply use the url property can not navigate to tabBar page requires a combination of open-type attribute for navigation.

<navigator url="/pages/home/home" open-type="switchTab">点击跳转</navigator>

 

3. Back navigation

To back to the previous page or the page level, the need to set the navigateBack open-type, delta while using the specified property back layers.

<Navigator open-type = "navigateBack" delta = "1"> Back surface </ navigator>

 


Programmatic navigation

1. Navigate to non tabBar page

By wx.navigateTO (Object) method, you can jump to a page within the application, but you can not jump to tabBar page. Wherein the object property list Object parameters are as follows.

url: string, required, need to jump the application of non-tabBar path, the path may be behind a path between a parameter is carrying? Separated, and the key parameter value = connected, different parameters & separated.

success: function, optional interface call is successful callback function.

fail: function, optional interface call failed callback function.

complate: function, optional interface to call the end of the callback function call success and failure will be executed.

<view><button bindtap="btn">logs</button></view>

btn: function () {
    wx.navigateTo({
      url: '/pages/logs/logs',
    })
  }

 

2. Navigate to the page tabBar

By wx.switchTab (Object, Object) method, tabBar can jump to the page, and close all other non tabBar page, wherein object properties of the Object parameters as follows:

url: string, required, need to jump the application of non-tabBar path, the path may be behind a path between a parameter is carrying? Separated, and the key parameter value = connected, different parameters & separated.

success: function, optional interface call is successful callback function.

fail: function, optional interface call failed callback function.

complate: function, optional interface to call the end of the callback function call success and failure will be executed.

 

3. Back navigation

By wx.navigateBack (Object) method, to close the current page, previous page or multilevel page parameters are as follows:

delta: number, required, number of pages returned if the delta is greater than the existing number of pages, then return home

success: function, optional interface call is successful callback function.

fail: function, optional interface call failed callback function.

complate: function, optional interface to call the end of the callback function call success and failure will be executed.

 


 

Navigation parameter passing:

Small mass participation program url html like, you can pass parameters after the address.

 

Reception parameters:

Whether the parameter navigation or declarative programming style navigation, navigate to the final page can receive a pass over the lifecycle of the onLoad function.

onLoad: function (options) {

    console.log(options)

}

 

Custom compilation mode quickly pass parameters:

After the applet every time you modify and compile the code, enter the default home page, but in the development stage, we often develop for a particular page, go directly to the corresponding page in order to facilitate the compilation, you can configure a custom compilation mode, follow these steps:
1 click on the toolbar ordinary compilation, the drop-down menu,

Add Compilation-Mode Options 2. Click the drop-down menu

3. In the pop-up window custom compiled conditions, added on demand model name, start page, startup parameters.

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/liea/p/11803715.html