第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

請(qǐng)問(wèn)在小程序中如何從請(qǐng)求success中將數(shù)據(jù)返回給對(duì)象data?

請(qǐng)問(wèn)在小程序中如何從請(qǐng)求success中將數(shù)據(jù)返回給對(duì)象data?

我的代碼如下:App({     data: {         posts: {}     },     onLaunch(event) {         // console.log('onLaunch');         var that = this;         swan.request({             url: 'http://www.sfatpaper.com/content.json',             success: function (res) {                 console.log(res.data);                 that.setData({                     posts: res.data.posts                 });             },             fail: function (err) {                 console.log('錯(cuò)誤碼:' + err.errCode);                 console.log('錯(cuò)誤信息:' + err.errMsg);             }         })           } });通過(guò)ajax,目前可以順利讀取接口數(shù)據(jù),其中posts的數(shù)據(jù)有兩項(xiàng)posts:Array(2)    0:Object     1:Object我想通過(guò)that.setData將數(shù)據(jù)傳給外層的data對(duì)象,以便其他頁(yè)面調(diào)用但是報(bào)錯(cuò)顯示:Uncaught (in promise) TypeError: that.setData is not a function還望指正,問(wèn)題出在那里呢?謝謝!
查看完整描述

1 回答

?
動(dòng)漫人物

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超10個(gè)贊

App沒(méi)有setData, 直接用this.globalData
Page才有


查看完整回答
反對(duì) 回復(fù) 2018-12-17
  • 1 回答
  • 0 關(guān)注
  • 905 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)