Skip to content

Unclear structure of params object #2503

Closed
@rchl

Description

@rchl

Version

3.0.2

Reproduction link

https://codesandbox.io/s/lykxn57kr7

Steps to reproduce

Access $route.params[0] for route with a *.

What is expected?

The matched part is returned.

What is actually happening?

Value is undefined. The value is at pathMatch property instead.


https://github.com/vuejs/vue-router/pull/1995/files (@posva) has done a change that changes from having 0 property on the params object to having pathMatch.

I would argue that this is an API breaking change and should be done in a major version release. I would, but params object is not documented very well so it's hard to reason about. (see https://router.vuejs.org/api/#route-object-properties)

As the damage is done already, maybe you can use this bug to improve on documentation and state in documentation for $route.params where the matched part is exposed for routes that are using *.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions