How to realize page jump and parameter transfer in WeChat Mini Programs
This article mainly introduces the relevant knowledge of how to achieve page jump and parameter transfer in WeChat Mini Programs, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will have something to gain after reading this WeChat Mini Programs article on how to achieve page jump and parameter transfer. Let's take a look.
The realization of WeChat Mini Programs's Page Jump and Parameter transfer
Foreword:
The jump in WeChat Mini Programs is actually similar to the hyperlink an in html. We can achieve the jump through tags or through js. Let's demonstrate it one by one below.
Before showing demo, we need to simply set up the project folder and get ready. As follows:
Label implementation
Mini Program has a navigator tag similar to the a tag, which is used for jump processing.
Index page:
Jump to a new page jump to the current page
Navigator pages and redirect pages:
{{title}}
Navigator.js pages and redirect.js pages:
Page ({data: {title:''}, onLoad:function (options) {/ / parameters brought by page initialization options for page jump this.setData ({title:options.title}),})
The jump is also divided into two types, one is to jump to the path behind the new page url and can carry parameters, the other is to add redirect after the page, open in the current page, and carry parameters.
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.
Tips: don't forget to configure the page you jump to in app.json, otherwise you will report an error.
2. Js implementation
To implement it with js, you only need to write the jump code, and others are as above.
Wx.navigateTo ({url:'.. / navigator/navigator?title= I am navi'}) wx.redirectTo ({url:'.. / redirect/redirect?title= I am red'})
Tips: if you take a closer look at the picture below, you will find that jumping to another page will have a back button, but not when you open it on the current page.
Picture display:
This is the end of the article on "how to achieve page jump and parameter transfer in WeChat Mini Programs". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to achieve page jump and parameter transfer in WeChat Mini Programs". If you want to learn more knowledge, you are welcome to follow the industry information channel.