vue 默认页面无法打开

默认打开的界面是白色的,需要输入正确的路由才能访问正确的页面。

router的index.ts(js)文件中设置路由规则,例如我们默认打开index页面,我们只需要设置routes:

const routes = [
    {
        path:"/",
        name:"brx",
        redirect:'/index'
    },
    {path:'/index', component: brx,},


    {
        path:'/test',
        name:"test",
        component:Test
    },
]

即可自动重定向到index页面

 

posted @ 2023-07-30 18:35  半日闲1  阅读(57)  评论(0编辑  收藏  举报