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 }) } }) }以上倆都是在監(jiān)聽頁(yè)面加載的時(shí)候的函數(shù),但是一個(gè)不用重定向this,一個(gè)需要定向this,不然就會(huì)報(bào)錯(cuò),為什么會(huì)出現(xiàn)這種情況呢第一段函數(shù)是一個(gè)子頁(yè)面 是要tabbar點(diǎn)進(jìn)去的頁(yè)面 難道是因?yàn)檫@個(gè)原因嗎 求大佬解答啊~
相同的地方為什么this指定的不一樣呢
瀟瀟雨雨
2019-03-21 18:15:06