The Asynchronous problem of main.js in vue Project

vue project, I have some asynchronous operations in main.js "s mounted, and routing is also loaded asynchronously. For example, when I set a settimeout, with a delay of 3s in main.js to visit a child routing page, I want to execute the mounted method of the corresponding vue file after performing all operations in the mounted of main.js (including asynchronous operations such as delay 3s, request interface, etc.). How should I do this?

Feb.14,2022

you can use the beforeEach hook function of router routing

const router = new Router({
    // ...
});

router.beforeEach((to, from, next) => {
    setTimeout(() => {
        // ...
        next();
    }, 3000);

    // ajax
    axios
        .get(url)
        .then(() => {
            // ...
            next();
        });
});
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-1b40117-2ba2e.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-1b40117-2ba2e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?