this post was submitted on 11 Sep 2023
2 points (100.0% liked)
Vue.js
463 readers
10 users here now
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
You can use the .push() method of vueRouter to push a state.
It is quite handy and, imo, better than the store solution:
Anyhow, it would look like this:
button @click="router.push({name: 'settings', state: { ...myObj } })">Go to page
to access it:
route.history.state
There is no need to stringify the object, so it's quite handy. https://developer.mozilla.org/en-US/docs/Web/API/History https://router.vuejs.org/guide/essentials/navigation.html#History-Manipulation