Why does this specify different things in the same place?

onLoad: function (options) {
      var that = this
        wx.request({
            url: "http://127.0.0.1:8889/api/club/userlist",
            data:{
                clubnumber:app.globalData.myclub
            },
            method:"post",
            header:{
                "content-type":"application/json"
            },
            success:function(res){
                that.setData({
                    userinfo:res.data
                })
            }
        })
  }


onLoad: function (options) {
        wx.request({
            url: "http://127.0.0.1:8889/api/club/finded",
            data:{
                name:app.globalData.findClub,
                number:app.globalData.findNumber
            },
            header:{
                "content-type":"application/json"
            },
            method:"post",
            success:(res)=>{
                const {name,clubclass,admin,member} = res.data
                this.setData({
                    name:name,
                    clubclass:clubclass,
                    admin:admin,
                    member:member
                })
            }
        })
  }

both of the above functions are used to listen when the page is loaded, but one does not need to redirect this, and the other needs to redirect this, otherwise it will report an error. Why is this happening

?

the first paragraph function is a sub-page that is to be clicked into by tabbar. Is it for this reason? ask the boss to answer ~

.
Mar.24,2021

in the first paragraph, you use the ordinary function as the callback function. At this time, the this direction has changed, pointing to the object where the event occurred, that is, pointing to the second paragraph of success, using the arrow function. There is no this in the arrow function (as I understand it), so the this in the arrow function points to the object that defines the arrow function, that is, the global this,this direction has not changed. Or the current page. It has nothing to do with tabbar

A popular article on the Nuggets points to this .
here are some specific pointing questions about this


do not see the second arrow function 0.0


because the calling place is different


arrow function inherits the scope of the context, but not the arrow function inherits the scope of the execution of this function


your first is a non-arrow function so the scope of this is not changed, the second one uses the arrow function to change the scope of this.

Menu