doctorComments(this.$route.params.hid, this.$route.params.fid, this.doctorHisId, this.createdon, this.pageno, 5) //1.axios请求数据
.then(d => {//2.处理数据
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这个数组的信息。想要用js promise的相关方法去链式调用,但是我这么写3里面的方法仍然取不到2里面设置的数据。取2里面的数组长度length是undfined。
vue.js.
各位大神,3里面的方法怎么才能取到2设置好后的值。
return
给你个例子 箭头函数后面有大括号要加return