Skip to content

@4.3.3 the redirect / to home is not effective when children get /:pathMatch(.*) #2268

@sherleysong

Description

@sherleysong

Reproduction

https://jsfiddle.net/5qv469nr/2/

Steps to reproduce the bug

{ path: '/', redirect: '/foo' },
{ path: '/foo', component: Foo },
{
path: '/:pathMatch(.*)',
component: Bar
}

Expected behavior

goto foo

Actual behavior

goto bar

Additional information

{ path: '/', redirect: '/foo' }, // when come to "/" , I hope go to foo page which is my actural home page { path: '/foo', component: Foo }, { path: '/:pathMatch(.*)', // when not "/ " or not "foo", I hope go to bar page , which is my 404 page . component: Bar }

the actural code is like this :

{ path: '/', name: 'home', component: Main, redirect: '/home', meta: { title: '首页' }, children: [ { path: '/home', name: 'home', meta: { title: '首页' }, component: () => import('src/components/home') }, { path: '/:pathMatch(.*)', component: () => import('src/components/error-page/404.vue') } ] }

the code before vue-router@4.3.2 is OK , but wrong when come to vue-router@4.3.3 .

can you fix it @4.3.4 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions