niclas_4
niclas_4

Reputation: 3674

Router Link to a new Page but keep Store data

I have a list of posts which on click navigate to the post view where you can read it. For the sake of User Experience i want it to open a new Tab on click of the post.

I achieve this with <nuxt-link :to="'posts/' + posts[0].docID" target="_blank">

My current website logic works with fetching the data of the posts from my Database into the store so that i dont have to fetch the post data again on post load. This works fine, but with my new logic of opening a new Tab the post Component doesnt find store data and so it fetches the database again.

How can i achieve a new tab behaviour without resetting the store and keeping the post data ready without a need to refetch?

Upvotes: 0

Views: 255

Answers (2)

Saurabh
Saurabh

Reputation: 1

You can use window.open('/posts/' + posts[0].docID)

Upvotes: 0

mayank modi
mayank modi

Reputation: 129

You can use Cookie or Local storage for this where you can save your data and re-fetch in new tab...

Hope this will help you..

Upvotes: 1

Related Questions