Skip to content

to parameter overly verbose when you have params #2952

@oppianmatt

Description

@oppianmatt

What problem does this feature solve?

Using the to parameter is overly verbose for example:

<router-link :to="{ name: 'user', params: { userId: 123 }}">User</router-link>

What does the proposed API look like?

Would be better to move some of the fields as props so you could have:

<router-link to="user" :params="{ userId: 123 }">User123</router-link>

This seems more natural to use. The first version I find I have to lookup the syntax each time, it's not obvious.

It's also a more natural progression for learning. For example you start with the basic:

<router-link to="/foo">Go to Foo</router-link>

And then to add a param you just add the param prop:

<router-link to="/foo" :params="{bar:123}">Go to Foo</router-link>

It's much easier for end users to learn and adopt. It's more obvious and straight forward. It's also backwards compatible (in that you just don't use the new props and the old way works also).

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