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

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

vue請求數(shù)據(jù)報(bào)錯(cuò)

vue請求數(shù)據(jù)報(bào)錯(cuò)

瀟瀟雨雨 2019-05-24 18:15:08
在created()的時(shí)候做數(shù)據(jù)請求:created(){this.getBanner()this.getHotRecommended()this.getNewAlbum(this.newAlbum.limit,this.newAlbum.offset)this.getToplist()},methods:{//獲取banner數(shù)據(jù)getBanner(){banner().then((res)=>{this.bannerList=res.data.banners})},//熱門推薦getHotRecommended(){hotRecommended().then((res)=>{this.hotRecommendedList=res.data.result})},//獲取新碟上架getNewAlbum(limit,offset){newAlbum(limit,offset).then((res)=>{this.newAlbum.data=res.data.albums})},//榜單getToplist(){//飆升榜toplist(3).then((res)=>{this.biaosheng=res.data.result})//新歌榜toplist(0).then((res)=>{this.xinge=res.data.result})//原創(chuàng)榜toplist(2).then((res)=>{this.yuanchuang=res.data.result})}}在開始進(jìn)入頁面的時(shí)候報(bào)錯(cuò),提示某個(gè)數(shù)據(jù)還沒有:[Vuewarn]:Errorinrenderfunction:"TypeError:Cannotreadproperty'coverImgUrl'ofnull"但是頁面加載完成后數(shù)據(jù)又正確加載了。請問這是什么原因造成的,是請求數(shù)據(jù)的時(shí)機(jī)不對嗎?
查看完整描述

2 回答

?
慕運(yùn)維8079593

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

檢查你的render函數(shù),上面爆出來的是renderfunction內(nèi)的報(bào)錯(cuò),跟你目前的執(zhí)行的代碼關(guān)系應(yīng)該不大。
建議在訪問對象屬性時(shí),做一下空值判斷。如state&&state.a&&state.a.b
                            
查看完整回答
反對 回復(fù) 2019-05-24
?
jeck貓

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

你將函數(shù)放在this.nextTick(function(){
this.getBanner()
this.getHotRecommended()
this.getNewAlbum(this.newAlbum.limit,this.newAlbum.offset)
this.getToplist()
})
                            
查看完整回答
反對 回復(fù) 2019-05-24
  • 2 回答
  • 0 關(guān)注
  • 717 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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