Skip to content

router.beforeEach with '/:pathMatch(.*)*' can not work perfectly. #601

@NO-MAP

Description

@NO-MAP

Version

4.0.0-rc.3

Reproduction link

https://codepen.io/no-map/pen/ZEONNxo

Steps to reproduce

i am using router.beforeEach function to add async routers.

as follows

router.beforeEach(async (to, from, next) => {
  if(noServiceRoutes) {
    await getServiceRoutes()
    router.addRoute()
    next({ ...to, replace: true })
  }
  ...
})

this is work.

but when i use '/:pathMatch(.)' to redirect all notFound routes to 404

 {
    path: '/:pathMatch(.*)*',
    redirect: '/404'
  },

something wrong.

when i refresh my brower. router.beforeEach can not work. allways redirect to 404 pages.

What is expected?

i think router.beforeEach shoud work.

What is actually happening?

router.beforeEach did not work.


please tell me how to make it works. thanks

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