self._entityService .getAll() .pipe( finalize(() => { if (self.sheet && self.sheet.length > 0) { self._xlsxService.exportAsExcelFile(self.sheet, "product_base", self.headers); } else { abp.message.warn("没有数据!"); } }) ) .subscribe((result) => { self.sheet = []; result.items.forEach(i => { self.sheet.push(self.toJSON(i)); }); });
Angular--TypeScript finalize 方法
原文:https://www.cnblogs.com/lishidefengchen/p/10709210.html