2👍
✅
Yes, if you open a new tab, Vue will need to re-hydrate from the start, you cannot transfer the state from one page to the other with just Vue.
You’ll need to use something to persist the data. A quick search brings up this exact answer with quite more details: https://stackoverflow.com/a/66872372/8816585
So, using localStorage could be a simple and quick way of getting things done
localStorage.setItem('persistThisData', JSON.stringify(coolData))
Then, on the other side
const coolData = JSON.parse(localStorage.getItem('persistThisData'))
Query params could also be a solution with
this.$router.push({ path: '/nice-page', query: { type: 'beautiful' } })
And getting it on the other side with
this.$route.query.type
A conditional checking if coolData
is populated in the other page (yet, same file) and everything should be working fine.
Source:stackexchange.com