doctorComments(this.$route.params.hid, this.$route.params.fid, this.doctorHisId, this.createdon, this.pageno, 5) //1.axios請求數(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.調用方法 this.$options.methods.compareHeightComment();})3.里面調用的方法需要doctorcommts這個數(shù)組的信息。想要用js promise的相關方法去鏈式調用,但是我這么寫3里面的方法仍然取不到2里面設置的數(shù)據(jù)。取2里面的數(shù)組長度length是undfined。vue.js.各位大神,3里面的方法怎么才能取到2設置好后的值。
axios 異步請求后.then()后再接.then()要怎么寫
森林海
2019-03-08 18:15:50