当前位置:网站首页>Applet page navigation

Applet page navigation

2022-07-05 20:26:00 'wx

1. What is page navigation

Page navigation refers to the mutual jump between pages

2. There are two ways to realize page navigation in applet

(1). Declarative navigation

         Create a... On the page <navigator> Navigation components

         By clicking on <navigator> Component to realize page Jump

(2) Programming navigation

Calling applet navigation API, Realize page Jump

3. Declarative navigation

        Navigate to tabBar page

Navigate to non tabBar page

	<navigator url="/pages/info/info?name=xiaoming&age=20">
		<button> Pass parameters </button>
	</navigator>

  Be careful : For convenience , Navigate to non tabBar When the page is ,open-type Properties can be omitted

4. Back navigation

 

  Be careful , If you only go back to the top page , It can be omitted delta attribute , The default value is 1

5. Programming navigation

        call wx.switchTab(Object object) Method , You can jump to tabBar page , among Object The attribute list of the parameter object is as follows :

attribute

type

Whether the choice

explain

url

string

yes

Need to jump  tabBar  The path of the page , The path cannot be followed by parameters

success

function

no

Interface calls the successful callback function

fail

function

no

Interface call failed callback function

complete

function

no

The callback function at the end of the interface call ( Successful call 、 Failure will be carried out )

// Page structure 	
<view> Programming navigation parameters </view>

		<button bindtap="goToInfo2"> Click to jump to info</button>
// Logical processing 
	goToInfo2(){
		wx.navigateTo({
			url: '/pages/info/info?name=lisi&age=20',
		})
	},

 

6. Back navigation

        call wx.navigateBack(Object obkect) Method , You can return to the previous page or multiple pages .

attribute

type

The default value is

Whether the choice

explain

delta

number

1

no

Number of pages returned , If  delta  Larger than the existing

Number of pages , Then go back to the home page

success

function

no

Interface calls the successful callback function

fail

function

no

Interface call failed callback function

complete

function

no

The callback function at the end of the interface call (

Successful call 、 Failure will be carried out )

 7. Navigation parameters

navigator Component's url Property is used to specify the page path to jump to , Parameters can be carried behind the path

        Between parameter and path ? Division

        Parameter key value pair adoption = The way

        Use... For different parameters & Division

  You can jump the route onLoad Get the routing parameters directly from the event

 

原网站

版权声明
本文为['wx]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207052018302756.html