0

Is it possible to open a Vue component in new tab by vue router without page reload.

Normal Way :

<a href="http://example.com" target="_blank">HtmlExample </a>

Vue Router

<router-link to="/example" target="_blank">Vue Router Example </a>

It's works properly but i need it without page reload.

4
  • 1
    Does this answer your question? Can vue-router open a link in a new tab? Commented May 4, 2020 at 16:20
  • "without page reload" What do you mean here? Like the current page or the page you are opening in a new tab. A new tab is a completely separate browser process so the answer would be no. Commented May 4, 2020 at 16:22
  • Everything is work properly no problem but I want to any if there any process available to switch one component to another component by Vue router in another tab. @JaredMcAteer Commented May 4, 2020 at 16:24
  • I don't think you're going to be able to do this with a simple router link. If you want to control another window you'll probably need to use the postMessage API and implement some system for communicating between the windows. You might be able to spawn a popup window with a specific id and set the target to the window id instead of "blank" but I don't think if pushState will work that way. Commented May 4, 2020 at 16:49

1 Answer 1

0

If I understood your issue correctly: new pages are always going to be loaded, since it's a vue lifecycle. Vue lifecycles. But what you can do here is to use browser's local storage. And when the component is mounted for example, you can share the data from your previous page.

Sign up to request clarification or add additional context in comments.

1 Comment

This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.