为了账号安全,请及时绑定邮箱和手机立即绑定

axios 异步请求后.then()后再接.then()要怎么写

axios 异步请求后.then()后再接.then()要怎么写

森林海 2019-03-08 18:15:50
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设置好后的值。
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 6644 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号