Skip to content

Inside guards, get to know current navigating is under router.replace or router.push. #2515

Closed
@masquevil

Description

@masquevil

What problem does this feature solve?

when doing router.replace('url'), next('otherUrl') will cause this navigation become router.push.

when doing router.push('url'), next({..., replace: true}) will cause this navigation become router.replace.

want to know current navigating statue inside guards to solve this problem.

What does the proposed API look like?

beforeEach: (to, from, next, infos) => {
  console.log(info.replace)    // true or false
}

or:

beforeEach: (to, from, next) => {
  console.log(to.replace)    // true or false
}

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