In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "how WeChat Mini Programs realizes the limit on the number of page openings". The editor shows you the operation process through an actual case. The method of operation is simple and fast, and it is practical. I hope that this "WeChat Mini Programs how to achieve page opening limit" article can help you solve the problem.
Preface
As we all know, whether in Mini Program or APP, opening a page is actually creating a new View object, layer by layer. When you click the back button on the page, you close the current page.
One problem involved in this process is the number of open pages. In some designs, such as a product details page, other items will be recommended, and these items will be clicked into the details page. There are recommendations on the details page, and you can click in. In this way, more and more pages will be opened over and over again.
If there is no limit, it will definitely get stuck when the number of openings reaches a certain level. You can't open more than 10 pages in WeChat Mini Programs. After reaching 10 pages, you can't open new pages.
Before this problem, I thought it was Bug, whether it was stuck or not, but later I found that as long as I went back to a page, I could reopen it. The limit of up to 10 pages was discovered.
Specially investigated the Mini Program of other companies and found that there is indeed this problem. I made a hint here to tell the user not to open so many pages, otherwise the user will look at a loss and will not be able to light it.
Each page needs to load data interactively with the background, and I judge it in a unified Http request.
Instance code
Var pages = getCurrentPages (); console.log ("pages:" + pages.length); if (pages.length = = 10) {wx.showToast ({title: "too many pages open, please go back and close a few pages", icon: 'none', duration: 2000}) setTimeout (() = > {wx.navigateBack ({})}, 2000) return;}
When you open the 10th page, give a prompt, and then jump back to the previous page.
This is the end of the content about "how to achieve the limit on the number of page openings by WeChat Mini Programs". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.