doctorComments(this.$route.params.hid, this.$route.params.fid, this.doctorHisId, this.createdon, this.pageno, 5) //1.axios請(qǐng)求數(shù)據(jù).then(d => {//2.處理數(shù)據(jù) let dc = new Array() for(let i=0;i<d.list.length;i++){ dc[i] = {doctorComments:d.list[i],isZhanshiComment:false} } this.doctorComments = this.doctorComments.concat(dc); this.$refs.scroller.donePullup(); }).then(()=>{//3.調(diào)用方法 this.$options.methods.compareHeightComment();})3.里面調(diào)用的方法需要doctorcommts這個(gè)數(shù)組的信息。想要用js promise的相關(guān)方法去鏈?zhǔn)秸{(diào)用,但是我這么寫3里面的方法仍然取不到2里面設(shè)置的數(shù)據(jù)。取2里面的數(shù)組長(zhǎng)度length是undfined。vue.js.各位大神,3里面的方法怎么才能取到2設(shè)置好后的值。
axios 異步請(qǐng)求后.then()后再接.then()要怎么寫
森林海
2019-03-08 18:15:50