AI助手支持GPT4.0
新手问下setdata问题?The novice asks about setdata?
新手问下setdata问题?
Page({ onLoad() { var that = this; wx.request({ url: 'https://****', data: { x: '', y: '' }, header: { 'content-type': 'application/json' }, success (res) { console.log(res.data) this.setdata({motto:'测试赋值'}) } }) }})这两个语句都报错了,提示“this.setData is not a function”, 我用this.setdata和that.setdata都不行,新手求助,谢谢!!
Page({ onLoad() { var that = this; wx.request ({URL: 'HTTPS: / / * *', / / for example only, not real interface address, data: {X: ', Y:'}, header: {content type ':'application / JSON' / / default value}, success (res) {console.log ( res.data )this.setdata ({motto: 'test assignment'}) / / error reported// that.setdata ({motto: 'test assignment'}) / / error})}) both statements report errors, indicating that“ this.setData Is not a function " this.setdata and that.setdata No way, novice help, thank you! !
this指向问题 你上面都把this赋值给that为啥就是不用呢? 自己找罪受?