Your location:Tech News>News>Script>Several methods to achieve micro-channel transmission parameters applet example

Latest News

Several methods to achieve micro-channel transmission parameters applet example

Author:fsadmin

Views:

  Foreword

  First to say something, because the company needs, I also began to jump into a pit of a small program, fill the pit road hard and sad, although there are many pits Well, but after all applet to appear soon, there is also a normal pit, ha ha ha not nonsense, it said transfer applet parameter, did not talk much to say, to see a detailed description with it.

  First, when the navigator Jump

  wxml page (available parameters for a long time "&")

  

  Or add a click event, js navigateTo jump with mass participation, as two effects

  wx.navigateTo ({

  url: ''https: // www.jb51.net / index / index?id = 1 & name = aaa '',

  })

  js direct access to the page where onLoad

  onLoad: function (options) {

  // initialize options page is the page jump brought parameter

  var id = options.id // get the value

  },

  Second, global variables

  app.js page

  globalData: {

  id: null

  }

  Assignment:

  var app = getApp ();

  app.globalData.id = 2

  Value:

  var app = getApp ();

  var id = app.globalData.id

  Third, the list of index index values

  wxml page

  

  If desired a plurality of transfer, one could write DATA- [parameters] transmitting manner

  js page

  clickMe: function (e) {

  var id = e.currentTarget.dataset.id

  console.log (id);

  },

  Note: By wxml setting data- [parameter name] pass parameters, [parameter name] only lowercase, not uppercase

  Four, form Form traditional values

  relatively simple form form common traditional values, the example is not

  to sum up

  That''s all for this article, I hope the contents of this paper has some reference value of learning for all of us to learn or work, if in doubt you can leave a message exchange, thank you for the support scripts House.

  You may also be interested in the article: micro-channel applet url parameter passing write variables method micro letter applet multiple pages pass parameters to communicate the learning and practice of micro-channel applet dynamic mass participation of detailed examples of micro-channel applet jump pass parameters to pass objects Detailed and example code small micro-channel mass participation program link a new page and jump micro-channel applet page biography reference example explanation micro letter applet page jump pass parameters Detailed micro-channel applet Back mass participation and resolve the refresh process

Recommend article

Relate article