Small micro-channel program links Jump

Jump applet is actually click event, because only one click to jump, the name of this event is called bindtap, and website development in the click events, events are triggered when clicked, write it in the view tag , as shown:
Here Insert Picture Description
then enter the empty .js file, enter the page and select the drop-down list in the page, and then press enter, the situation will be as shown:
Here Insert Picture Description
writing go event:
Here Insert Picture Description
micro-channel applet page jump method summary:
1, using a small program provides an API Jump:
a, to retain the current page, jump to a page within the application, using wx.navigateBack to return to the original page.
Note: when calling navigateTo jumps, calls the method page will be added to the stack.

wx.navigateTo({
  url: '../home/home?user_id=111'
})

B, close the current page, previous page or multilevel page. Can get the current page stack by getCurrentPages (), the decision needs to return several layers.

wx.navigateTo({
  url: '../home/home?user_id=111'  			// 页面 A
})
wx.navigateTo({
  url: '../detail/detail?product_id=222'  	// 页面 B
})
// 跳转到页面 A
wx.navigateBack({
  delta: 2
})

c, close the current page, jump to a page within the application.

wx.redirectTo({
  url: '../home/home?user_id=111'
})

d, tabBar jump to the page (registered in app.json in tabBar page), while closing the other non-tabBar page.

wx.switchTab({
  url: '../index/index'
})

e, close all pages, open a page in the application.

wx.reLanch({
  url: '../home/home?user_id=111'
}) 

2, wxml assembly page jump (jump mode may be specified by setting the page open-type property):
A, Navigator default open-type assembly to navigate

<navigator url="../navigate/navigate?title=navigate" hover-class="navigator-hover">跳转到新页面</navigator>

b, redirect the corresponding method of the API wx.redirect

<navigator url="../redirect/redirect?title=redirect" open-type="redirect" hover-class="other-navigator-hover">在当前页打开</navigator>

c, switchTab method corresponding to the API wx.switchTab

<navigator url="../index/index" open-type="switchTab" hover-class="other-navigator-hover">切换 Tab</navigator>

d, reLanch method corresponding to the API wx.reLanch

<navigator url="../redirect/redirect?title=redirect" open-type="redirect" hover-class="other-navigator-hover">关闭所有页面,打开到应用内的某个页面</navigator>

e, navigateBack method corresponding to the API wx.navigateBack

<navigator url="../index/index" open-type="navigateBack" hover-class="other-navigator-hover">关闭当前页面,返回上一级页面或多级页面</navigator>

Reprinted from: https://www.cnblogs.com/yaoyuqian/p/7967472.html

Guess you like

Origin blog.csdn.net/qq_38882327/article/details/91351753