Skip to content

Add fullpath in matched object #1435

@issaTan

Description

@issaTan

What problem does this feature solve?

I want to create a breadcrumb use the route.matched, but when I has the paramas in the router path, it doesn't work because the route.matched object only return the path but not fullpath.
example:

{
   path: '/course',
   name: 'Course',
   component: Layout,
   children: [{
     path: ':cousrId/edit',
     name: 'CourseEdit',
     component: Course,
     children: [{
       path: 'lesson',
       name: 'CourseLesson',
       component: CourseLesson
     }]
   }]
}

I want to create a breadcrumb like

<a href="/course">course</a> > <a href="/course/2/edit">course edit</a> > <a href="">course edit lesson</a>

when I click the course edit link, I can get the params courseId === 2, but I only get the path /course/:courseId/edit in the router.matched[1], the params doed not resolved, I could not got the real courseId in the route.mathed object.

(我想使用route.matched 创建一个面包屑,但当我的路径中参数例如courseId 时,route.matched 返回的path 是未解析参数的 /course/:courseId/edit。或许是我思路错了?请指教)

What does the proposed API look like?

resolved the params in each object at route.matched object base on the current url

[{
  path: '/course/:courseId/edit,
  fullpath: '/course/2/edit
}]

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