在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ī)不對嗎?
vue請求數(shù)據(jù)報(bào)錯(cuò)
瀟瀟雨雨
2019-05-24 18:15:08