Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of WeChat Mini Programs preventing being unable to return to the home page

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to solve the problem that WeChat Mini Programs can not return to the home page". Interested friends might as well take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn how to solve the problem that WeChat Mini Programs can not return to the home page.

Problem scenario:

After a page of Mini Program is completed, you want to jump to another related page.

For example, after the order is submitted, you want to jump to the order details page. There are two options.

A uses wx.navigateTo to jump to a non-tabBar page

The advantage is that there is a back button, which can return to the home page step by step

The disadvantage is that the user experience is poor, and it is possible to reissue orders.

B use wx.redirectTo to jump to a non-tabBar page

The advantage is that the old page will not be returned

The disadvantage is that it is unable to return to the home page, resulting in an endless loop

Solution.

1. Use the wx.reLaunch feature with parameters to jump to the tabbar page, such as

Wx.reLaunch ({url:'/ pages/me/me?pageId=mypublishhome'})

2. Add judgment to the onLoad of the pages/me/me page to manage the jump, so that the newly opened page

Pages/me/mypublishhome/mypublishhome can return to the tabbar page, and then go to other home pages.

OnLoad: function (options) {that = this; console.log ('options of the current page is', options); the existence of the value of if (options.pageId) {/ / this pageId proves that the opening of the home page comes from the user clicking console.log ('the options of the current page is', options.pageId) Wx.navigateTo ({url:'/ pages/me/' + options.pageId +'/'+ options.pageId,})}} so far, I believe you have a better understanding of "how to solve the problem that WeChat Mini Programs can not return to the home page". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report