WeChat applet jump problem

WeChat officially gives five redirect APIs

①wx.switchTab(Object object)

Jump to the tabBar page and close all other non-tabBar pages

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

②wx.reLaunch(Object object)

Close all pages and open to a page in the app

wx.reLaunch({
  url: 'test?id=1'
})

③wx.redirectTo(Object object)

Close the current page and jump to a page in the app. But it is not allowed to jump to the tabbar page.

wx.redirectTo({
  url: 'test?id=1'
})

④wx.navigateTo(Object object)

Keep the current page and jump to a page in the app. But you cannot jump to the tabbar page. Use wx.navigateBack to return to the original page. The page stack in the applet is up to ten levels.

wx.navigateTo({
  url: 'test?id=1'
})

⑤wx.navigateBack(Object object)

Close the current page and return to the previous page or multi-level pages. You can get the current page stack through getCurrentPages() and decide how many layers you need to return.

// 注意:调用 navigateTo 跳转时,调用该方法的页面会被加入堆栈,而 redirectTo 方法则不会。见下方示例代码

// 此处是A页面
wx.navigateTo({
  url: 'B?id=1'
})

// 此处是B页面
wx.navigateTo({
  url: 'C?id=1'
})

// 在C页面内 navigateBack,将返回A页面
wx.navigateBack({
  delta: 2
})

Guess you like

Origin blog.csdn.net/michaelxuzhi___/article/details/109138494