怎样才能把函数里的值放进空对象里呢?
怎样才能把
avatarObj.id = '123';
avatarObj.url = '888';
添加进 avatarObj对象里?
按这样的代码console.log avatarObj为空。是要使用return才行吗?
var avatarObj = {};
model.uploadFile({
report:true,
data:{
file:{
url: 'img/demo.png'
},
}
},function(ret, err) {
if (ret) {
var state = ret.state;
if (state == 1) {
//上传完成
var body = ret.body;
if (body) {
api.alert({msg:JSON.stringify(ret)});
avatarObj.id = '123';
avatarObj.url = '888';
}
} else {
}
} else {
}
});
console.log(JSON.stringify(avatarObj));
兔子sky
9 years, 3 months ago