Reputation: 43
I am currently trying to pass an array thats accessible on one page to the next. The next page is accessed on a forms submission using this.$router.push('path')
Is there any way for me to pass the array over as well when submitting the form so that I can access it on the new page?
Upvotes: 2
Views: 793
Reputation: 1
If you don't wanna use vuex or other store managers then the simplest way could be doing
this.$router.push('path').then(() => { this.$route.params.yourArray = ['value'] })
and then in the destination component use that same
this.$route.params.yourArray
Upvotes: 0
Reputation: 46696
You can't do that with Vue router directly as explained in this answer, you can only pass String
type.
If you want to access it on another page, you can either:
Upvotes: 2