Analysis of parameters passed between pages in WeChat mini programs

不言
Release: 2018-06-27 15:27:33
Original
1811 people have browsed it

This article mainly introduces relevant information on detailed examples of parameter transfer between WeChat applet pages. Friends in need can refer to the following

WeChat applet parameter transfer:

Implementation renderings:

WeChat applet passing parameters between two is similar to js passing url splicing parameters, let’s give an example

Input your own parameters

//index.wxml
<form bindsubmit="formSubmit" bindreset="formReset" class="myform">
 <text class="prompt">给自己起个名字吧</text>
 <input placeholder="给自己起个名字吧" name="uesrname"/>
 <!--<navigator url="../logs/logs?title=我是index" >跳转到新页面</navigator>   之间传参-->
 <!--<navigator url="../logs/logs?title=我是index" redirect>在当前页打开</navigator>   -->
 <button form-type="submit" type="primary" size="mini">确定</button>
 <button form-type="reset" type="warn" size="mini">重置</button>
 </form>
Copy after login

formSubmit:function(e){
  var da = e.detail.value;
  var qu = da.uesrname;
  this.setData({
   username:qu
  }),
  wx.navigateTo({
   url: &#39;../logs/logs?uesrname=&#39;+qu //qu是上面input输入的值
  })
 },
Copy after login

logs.js

//logs.js
 
Page({
 data: {
  motto: &#39;Hello&#39;,
  userInfo: {},
  answer: stringAns,
  uesrname:&#39;&#39;  //设置一下接收的变量
 },
 onLoad: function (option) { 
  this.setData({
   uesrname:option.uesrname
  })
 },
Copy after login

The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Encapsulation of post method and get method in WeChat mini program

About jumping in WeChat mini program Analysis of transfer parameters and transfer objects

About dynamic parameter transfer of WeChat applet

The above is the detailed content of Analysis of parameters passed between pages in WeChat mini programs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template