WeChat Mini Programs data transmission

how does the following code wx.navigateTo get the data of wx.request

?

use this.data. * to undefined directly and ask the master to give me some advice

Thank you here!

//index.js

var config = require("../../config")
var util = require("../../utils/util.js")
//app
var app = getApp()
Page({
  data: {
    area: app.globalData.area,
    areaIndex: 0,
    fluid: app.globalData.fluid,
    fluidIndex: 1,
    circuit: app.globalData.circuit,
    circuitIndex: 0,
    train: app.globalData.train,
    trainIndex: 55
  },
  bindareaChange: function (e) {
    this.setData({
      areaIndex: e.detail.value
    })
  },
  bindfluidChange: function (e) {
    this.setData({
      fluidIndex: e.detail.value
    })
  },
  bindcircuitChange: function (e) {
    this.setData({
      circuitIndex: e.detail.value
    })
  },
  bindtrainChange: function (e) {
    this.setData({
      trainIndex: e.detail.value
    })
  },
  formSubmit: function (e) {

    wx.request({
      url: `${config.service.host}/valid.htm`,
      data: {
        area: this.data.area[e.detail.value.area],
        fluid: this.data.fluid[e.detail.value.fluid],
        circuit: this.data.circuit[e.detail.value.circuit],
        line: e.detail.value.line,
        train: this.data.train[e.detail.value.train],
        hist: e.detail.value.hist
      },
      header: {
        //"content-type": "application/json" // 
        "Content-Type": "application/x-www-form-urlencoded"
      },
      method: "POST",
      success: function (res) {
        //var that = this;//thisthat
        console.log(data.area)
        if (res.data === "OK"){
          
          wx.navigateTo({
            url: "../addCgi/addCgi?area=" + this.data.area + "&fluid=" + this.data.fluid + "&circuit=" + this.data.circuit+ "&line=" + e.detail.value.line + "&train=" + this.data.train + "&hist=" + e.detail.value.hist,
            //url: "../addCgi/addCgi?area=",
            success(res) {
              //util.showBusy(that.data.area)
            },
             fail(error) {
              util.showModel("", error)
            }

          });
        }else{
          util.showModel("", res.data)
        }

      }
    })
  },
  formReset: function () {
    console.log("formreset")
  }

})
Mar.04,2021

you can set the data, in app when you define data,wx.request in app, and then get this data when you wx.navigateTo.

Menu