Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set target= '_blank' in router-link of vuejs 2.5

Using vuejs 2.5 if there is a way in router-link to set

target= '_blank'

? I tried this way:

<router-link :to="{name: 'UserProfileView', params: {id: participantUser.user_id}, target: '_blank' }"  >  

but failed...

Thanks!

like image 978
user2339232 Avatar asked Jan 15 '18 15:01

user2339232


2 Answers

You must to use method. Method looks something like this:

methods: {
     redirectToUserView(user) {
      const route = this.$router.resolve({
        name: 'UserProfileView',
        params: {id: participantUser.user_id},   
      });
      window.open(route.href, '_blank');
    },
 }
like image 133
Dm Prkp Avatar answered Sep 23 '22 14:09

Dm Prkp


You will add target='_blank' like on <a> tag

Hope is clear

like image 26
kalidou.diagne Avatar answered Sep 23 '22 14:09

kalidou.diagne