In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article "how to use wx.navigateTo in WeChat Mini Programs to return to the original page", the sample code in the article is very detailed and has certain reference value. Interested friends must refer to it. For "how to use wx.navigateTo to return to the original page in WeChat Mini Programs", the editor has sorted out the following knowledge points. Please follow the steps of the editor to understand step by step. Next, let's get to the subject.
Wx.navigateTo (OBJECT)
Keep the current page, jump to a page within the application, and use wx.navigateBack to return to the original page.
OBJECT parameter description:
Required parameter type indicates that urlString is the path of non-tabBar pages in the application to be redirected, which can be followed by parameters. Use between parameters and paths? Separate, parameter keys and parameter values are connected by =, and different parameters are separated by &. For example, 'path?key=value&key2=value2'successFunction No API calls successful callback function failFunction No API calls failed callback function completeFunction No API calls end callback function (both successful and failed calls will be executed)
Sample code:
Wx.navigateTo ({url: 'test?id=1'}) / / test.jsPage ({onLoad: function (option) {console.log (option.query)}})
Note: in order not to cause trouble for users when using Mini Program, we stipulate that the page path can only be five layers, please try to avoid multi-level interaction.
Wx.redirectTo (OBJECT)
Close the current page and jump to a page within the application.
OBJECT parameter description:
Required parameter type indicates that urlString is the path of non-tabBar pages in the application to be redirected, which can be followed by parameters. Use between parameters and paths? Separate, parameter keys and parameter values are connected by =, and different parameters are separated by &. For example, 'path?key=value&key2=value2'successFunction No API calls successful callback function failFunction No API calls failed callback function completeFunction No API calls end callback function (both successful and failed calls will be executed)
Sample code:
Wx.redirectTo ({url: 'test?id=1'}) wx.reLaunch (OBJECT)
The basic library version 1.1.0 is supported, and the lower version needs to be compatible.
Close all pages and open to a page within the application.
OBJECT parameter description:
Required parameter type indicates that urlString is the path of non-tabBar pages in the application to be redirected, which can be followed by parameters. Use between parameters and paths? Separate: parameter key and parameter value are connected by =, and different parameters are separated by &. For example, path?key=value&key2=value2', cannot call successful callback function successFunction No API call successful callback function failFunction No API call failed callback function completeFunction No API call the finished callback function if the page path you jump to is a tabBar page (both successful and failed calls will be executed)
Sample code:
Wx.reLaunch ({url: 'test?id=1'}) / / test.jsPage ({onLoad: function (option) {console.log (option.query)}}) wx.switchTab (OBJECT)
Jump to the tabBar page and close all other non-tabBar pages
OBJECT parameter description:
Parameter type is required indicating that urlString is the path of the tabBar page that needs to be redirected (you need to define it in the tabBar field of app.json). After the path, you cannot call successful callback function failFunction No API call failed callback function failFunction No API call failed callback function completeFunction No API call end callback function (both successful and failed call will be executed)
Sample code:
{"tabBar": {"list": [{"pagePath": "index", "text": "Home"}, {"pagePath": "other", "text": "other"]}} wx.switchTab ({url:'/ index'}) wx.navigateBack (OBJECT)
Close the current page and return to the previous or multi-level page. You can get the current page stack through getCurrentPages () and decide how many layers you need to return.
OBJECT parameter description:
The default value of the parameter type indicates the number of pages returned by deltaNumber1. If the delta is greater than the number of existing pages, return to the home page.
Sample code:
/ / Note: when a navigateTo jump is called, the page that calls this method will be added to the stack, but the redirectTo method will not. See the sample code below / / here is the A page wx.navigateTo ({url: 'indexed 1'}) / / here is the B page wx.navigateTo ({url:' clocked 1'}) / / inside the C page navigateBack, you will return page A wx.navigateBack ({delta: 2}) what does Mini Program mean by downloading and installing it? use it immediately by scanning the QR code or searching for it. It is easy to operate and easy to spread, and can realize seven functions, such as message notification, offline scanning code, official account association and so on. It is based on Wechat, similar to APP. You can use it whenever you want. After using it, you will leave without taking up memory.
The above is all the contents of the article "how to use wx.navigateTo in WeChat Mini Programs to return to the original page". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.