self.currtObj.list.forEach(function(item){
if(item.content.sendState){ //自己发送
var srehtml = Jmconf.sendstr_mine;
if(item.content.msg_type=='image'){
JIM.getResource({
'media_id' : item.content.msg_body.media_id,
}).onSuccess(function(data) {
var srcimg = '<img style="width:100px" src="'+ data.url +'" alt="">'
console.log( data.url);
srehtml = srehtml.replace('{{jmcell.content.msg_body.text}}', srcimg);
htmlset+=srehtml
})
}
}
})
能用Promise吗?如果可以,用Promise.all(...).then(...)
在then回调中,所有异步请求都完成,可以在里面拼接字符串。