WeChat Mini Programs this.setData async problem.


Page({

  /**
   * 
   */
  data: {
    category:[],
    ctime:[],
    target:[],
    addres:[],
    index: 0,
    indextarget:0,
    indexcategory:0,
    indexctime:0,
    indexaddres:0,
    addresinit:true,
    ctimeinit:true,
    targeinit:true,
    categoryinit:true,
    menuTapCurrent:0,
    selectaddres:"",
    selectctime:""
  },
  
  bindaddresChange:function(e) {
    // console.log("picker", e.detail.value)
    this.setData({
      indexaddres: e.detail.value,
      addresinit:false,
      selectaddres:this.data.addres[this.data.indexaddres]  //
    })
    console.log(this.data.addres[this.data.indexaddres],"")
    this.schoolList() 
  },
  /**
   * --
   */
  schoolList:function(obj={ctime:"",addres:""}){
    console.log( this.data.selectaddres,"")
   
    wx.request({
      url: schoolsearch ,//
      method: "GET",
      header: {
        "content-type": "application/x-www-form-urlencoded"
      },
      data: {
        page:1,
        ctime:this.data.selectctime,
        addres:this.data.selectaddres
      },
      success: (res) => {
        console.log(res,"shoole")
      },
      fail: function (res) {
        console.log(res)
      }
    })
  },
  onLoad: function (options) {
 
    //
    this.schoolList()
  },

})


roughly means that I encapsulate an interface to query the list of schools called schoolList.
when I choose the bindaddresChange method of the school address, I have changed the selectaddres, and agreed to it in the first step. I have just chosen the address. However, when I call the schoolList method to filter below, the value of selectaddres is not what I just selected. I know that the this.setData is asynchronous. The callback function can be written in this.setData ({userInfo: userInfo}, callback)) for online query, but it still doesn"t work. Has anyone ever encountered such a problem?

Apr.12,2021

selectaddres: this.data.addres [e.detail.value]

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b5e1-2c295.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b5e1-2c295.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?