Vue project startup setting default startup page

        When we start the vue project, the interface opened by default is white, and we need to enter the correct route to access the correct page. How should we make the default jump to the page we want to start when the project is opened?

        We need to set routing rules in the router's index.ts (js) file, for example, we open the index page by default, we only need to set the routes, the content is as follows:

routes:[
        {
            path:'/index',
            component:Index 
        },
        {
            path:'/',
            redirect:'/index'  //默认显示
        }
    ]

In this way, when the project is opened, it will be automatically redirected to the index page.

Ok, it's over!

Guess you like

Origin blog.csdn.net/Yajyaj123/article/details/126803935