Applet development, transfer parameters between two pages:

Small program development, transfer between two page parameters:
Principle: a page is to xxx.js of data: {} variable value passed to another page, of course, first you have a first value passed to this page on the page background

Then the following code, passed to another page yyy.js

We use wx.navigatorTo () method:

As shown above, like http get requests, the write directly on the parameters in the back you can
then write the following code to the new page in the life cycle method is to last page :( pass over the parameter, the parameter is set to the current page)

/**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.setData({
      newsUrl: options.newsUrl
    })
  }

Then can be used directly {{newsUrl}] This variable in the new page

Guess you like

Origin www.cnblogs.com/Lyn4ever/p/11113226.html