在created()的時候做數據請求:created(){this.getBanner()this.getHotRecommended()this.getNewAlbum(this.newAlbum.limit,this.newAlbum.offset)this.getToplist()},methods:{//獲取banner數據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})//原創榜toplist(2).then((res)=>{this.yuanchuang=res.data.result})}}在開始進入頁面的時候報錯,提示某個數據還沒有:[Vuewarn]:Errorinrenderfunction:"TypeError:Cannotreadproperty'coverImgUrl'ofnull"但是頁面加載完成后數據又正確加載了。請問這是什么原因造成的,是請求數據的時機不對嗎?
vue請求數據報錯
瀟瀟雨雨
2019-05-24 18:15:08