Async/await async problem

requirements: when the page is loaded, send two requests at the same time, the code is as follows:

        async initData(id){
            //
            let res1 = await getPathCategory(id);
            this.categoryList = res1.result.list;

            //
            let res2 = await getPathListData(id,this.category,this.pageSize,this.pageNo);
            if(res2.result.list.length>0){
                this.pathList = [...res2.result.list];
                this.loading = false;
            }
        },

question: when you enter the current page from the previous page, only the first requested data is obtained. When the current page is refreshed again, the data will come out together

Mar.04,2022

it is recommended to check the overall logic. It is unlikely that something will go wrong here


try the following. Both functions need to be executed:

let resAll = await Promise.all(getPathCategory(id), getPathListData(id,this.category,this.pageSize,this.pageNo));

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37312-2c067.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37312-2c067.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?