In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the knowledge of "how to return to tabBar without refreshing the page in WeChat Mini Programs". The editor shows you the process of operation through an actual case. The method of operation is simple and fast, and it is practical. I hope this article "how to return to tabBar without refreshing page in WeChat Mini Programs" can help you solve the problem.
1. In a project, you encounter this scenario: to return to a page in tabBar, you need to save the data, but when you enter this page, you need to clear the data.
2. The scenario is as follows: when you go to the next step for repair, you cannot refresh the page (that is, keep the page data) when you return to the first step. When you enter the repair page from other tabBar, you need to clear the data that may have been filled in.
3, the solution, in the second step page to do a local storage variable, in the first step page to determine the variable and then determine whether the second step page return.
Among them, because the first step has the operation of uploading images, it will also execute "onShow", so a new variable is added to the current page to determine whether onShow is caused by uploading images.
Step 2: page code:
OnShow: function () {wx.setStorageSync ('repair',1)}
The first step is the page code: note: temp is 0 when it is declared, and this variable is set to 1 after the image is uploaded successfully.
OnShow: function () {let value = wx.getStorageSync ('repair'); var _ tmp = this.data.temp; / / if (! value) {/ / empty data this.setData ({data: "})}}, onHide: function () {if (this.data.temp) {wx.setStorageSync (' repair', 1);} else {wx.removeStorageSync (" repair ") }}, this is the end of the content about "how to return tabBar without refreshing the page in 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.