Angular--TypeScript finalize 方法

    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));
                });
            });

猜你喜欢

转载自www.cnblogs.com/lishidefengchen/p/10709210.html