數(shù)據(jù)獲取正常,但是這段代碼提示錯(cuò)誤loadData(){? ? ? ? this.$http.get('static/data/data.json').then((res)=>{????????????????//this.data = res.body.list;? ? ? ? ? ????//console.log(this.data);? ? ? ? ? this.data = res.data.concat(this.data)? ? ? ? ? this.$nextTick(()=>{? ? ? ? ? ? if (!this.scroll) {? ? ? ? ? ? ? this.scroll = new BScroll(this.$refs.wrapper,{})? ? ? ? ? ? ? this.scroll.on('touchend',(pos)=>{? ? ? ? ? ? ? ? //下拉? ? ? ? ? ? ? ? if (pos.y > 50) {? ? ? ? ? ? ? ? ? this.loadData()? ? ? ? ? ? ? ? }? ? ? ? ? ? ? })? ? ? ? ? ? }else{? ? ? ? ? ? ? this.scroll.refresh();? ? ? ? ? ? }? ? ? ? ? })? ? ? ? })? ? ? }大家?guī)兔纯?
1 回答

Caballarii
TA貢獻(xiàn)1123條經(jīng)驗(yàn) 獲得超629個(gè)贊
res.data不一定是數(shù)組,有可能是null或者undefined,所以要判斷一下才能用concat
添加回答
舉報(bào)
0/150
提交
取消