Vue.js Open link in new tab


We can use native JavaScript window.open property to open a link(url) in new tab. Here in this tutorial, we are going to explain how you can use this property to open a link in new tab.


Vue.js Open link in new tab JavaScript Example

Here in an example of opening url in new tab in Vue.js –

Example:

<div id="app">
	<button @click="myFunction()">Click Me</button>
</div>
<script>
 new Vue({
el: '#app',
  
  data: {
	  myModel:false
  },  
   methods:{
    myFunction: function () {		
		window.open("https://www.google.com", "_blank");		
    }
	}

});
</script> 

Try it »


Advertisements

Add Comment

📖 Read More