Javascript 在爱奥尼亚不推荐订阅
我在爱奥尼亚项目中有这样一条警告:“订阅已弃用:使用观察者而不是完全回调”。请帮忙Javascript 在爱奥尼亚不推荐订阅,javascript,ionic-framework,rxjs,Javascript,Ionic Framework,Rxjs,我在爱奥尼亚项目中有这样一条警告:“订阅已弃用:使用观察者而不是完全回调”。请帮忙 fetch(cb) { this.loadingIndicator = true; this.cservice.postNcRangoConta(this.body).subscribe( res => { try { if (res) { this.headers = Object.keys(res[0]);
fetch(cb) {
this.loadingIndicator = true;
this.cservice.postNcRangoConta(this.body).subscribe(
res => {
try {
if (res) {
this.headers = Object.keys(res[0]);
this.columns = this.getColumns(this.headers);
this.temp = [...res];
cb(res);
this.loadingIndicator = false;
}
} catch (error) {
this.loadingIndicator = false;
this.rows = null;
this.toast.presentToast('No se encontraron datos', 'warning');
}
},
err => {
console.log(err);
if (this.desde || this.hasta) {
this.loadingIndicator = false;
this.toast.presentToast('La API no responde', 'danger');
} else {
this.loadingIndicator = false;
this.toast.presentToast('Debe llenar las fechas', 'warning');
}
}
);
}
subscribe方法实际上并没有被弃用,但您使用它的方式已经被弃用。尝试切换到它的新语法
//已弃用
source.subscribe(
(res)=>cb(res),
error=>console.error(错误),
()=>console.log('Complete')
);
//推荐
source.subscribe({
下一步:(res)=>cb(res),
错误:error=>console.error(错误),
complete:()=>console.log('complete')
});
subscribe方法实际上并没有被弃用,但您使用它的方式已被弃用。尝试切换到它的新语法
//已弃用
source.subscribe(
(res)=>cb(res),
error=>console.error(错误),
()=>console.log('Complete')
);
//推荐
source.subscribe({
下一步:(res)=>cb(res),
错误:error=>console.error(错误),
complete:()=>console.log('complete')
});
Idk但仍突出显示“订阅”字Idk但仍突出显示“订阅”字