Skip to content

Is there any way to force navigation when clicking on a router-link even if the route doesn't change? #2430

@trandaison

Description

@trandaison

What problem does this feature solve?

Reload current page's state or refresh the page.

For example, I have a <HeaderBar> which contains a Home button, just like the Facebook one.
If I'm in another page (rather than Home), when I hit this button, it will navigate to Home. But when I'm in Home page, hit this button it does nothing.

It's expected to reload the page, and scroll to the top, right?

Please don't tell me to write out an action to refresh the state and scroll to top. This header bar is a shared component, and the Home button can be hit at any where.

What does the proposed API look like?

Some thing like

<router-link :to="{ name: 'Home', force: true }">Home</router-link>

or

this.$router.replace({ name: 'Home', force: true });

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