Skip to content

Allow router.push() to pass state #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 1, 2021
Merged

Conversation

posva
Copy link
Member

@posva posva commented Oct 15, 2021

Summary

  • Allow the user to pass a state property alongside path, query, and other properties to persist to history.state.
  • Allow the user to read the history.state directly at this.$route.state.

Programmatic navigation:

router.push({ name: 'Details', state: { showModal: true } })
router.replace({ state: { showModal: true } })

Links


Important: Do NOT comment on this PR. Please use the discussion thread linked above to provide feedback, as it provides branched discussions that are easier to follow. This also makes the edit history of the PR clearer.

@vuejs vuejs locked and limited conversation to collaborators Oct 15, 2021
@posva posva force-pushed the router/navigation-state branch from 0b779f7 to c149221 Compare October 15, 2021 14:41
@posva posva changed the title formatting Allow router.push() to pass state Oct 15, 2021
@posva posva added the final comments This RFC is in final comments period label Nov 4, 2021
@posva posva force-pushed the router/navigation-state branch from c149221 to 4471ec2 Compare December 1, 2021 14:40
@posva posva merged commit 48104bc into vuejs:master Dec 1, 2021
@posva posva deleted the router/navigation-state branch December 1, 2021 14:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
final comments This RFC is in final comments period
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant