Skip to content

v-slot navigate function - return optional Promise #3042

Open
@aeharding

Description

@aeharding

What problem does this feature solve?

I am trying to create a button within a router-link that shows a loading indicator when clicked (but still allows opening in a new tab, which should not show a loading indicator).

It would be nice if navigate($event) in the v-slot API could return a promise when it performs a .push/replace() so that I could stop the loading animation when the route fails to load, or succeeds, just like router.push/replace(to) does.

Right now the only way to do this in my app is to implement a programmatic push or replace call, which does not allow opening in a new tab.

Thank you so much!

What does the proposed API look like?

navigate(e) returns a Promise (the result of .push or .replace) if either of those functions are called within navigate(e). If neither is called, return nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestfixed on 4.xThis issue has been already fixed on the v4 but exists in v3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions