promise

121 阅读1分钟

1.并发

优化项目代码:

 async initPageData() {
            this.setCurrState('EXCEPTION');
            this.currAllPage = 1;
            this.currUnusualPage = 1;
            this.topSectionLoading = true;
            -----------------------------------
            await this.getSectionCount('ALL');
            await this.getExcSectionList();
            -----------------------------------
            
            await Promise.all([this.getSectionCount('ALL'),this.getExcSectionList()])
            -----------------------------------
            if (this.allSectionList.length !== 0) this.setAllSectionId(this.allSectionList[0].id);
            this.topSectionLoading = false;
        },