我正在尝试调用此函数
compatiblelist() {
CompatibleDevicesAPI().then(
response => {this.getCompatList(response)}
);
}
每当我致电{this.compatiblelist()}
函数CompatibleDevicesAPI()看起来像这样
export default function CompatibleDevicesAPI() {
return fetch("https://abc/jjklsd/jlasd").then((res) => {
let results = [];
for(var i=0;i<res.response.docs.length;i++){
let obj ={
'compManufacturer': res.response.docs[i].comanufacturer,
'comDisplayName': res.response.docs[i].comDisplayName ,
'id' : res.response.docs[i].id,
}
results.push(obj);
}
return results;
}).catch((error) => {
let results = [];
results.push({
'comManufacturer': 'error',
'comDisplayName': error
})
return results;
});
}
答案 0 :(得分:1)
我认为您只需要添加退货
.then( response => {return this.getCompatList(response)} )