1
votes

In my nuxt js project , when user clicked button, method works and it creates a link. I route user to a new page. Sure i want to open this in new target . I could not find any solution for this in nuxt js.

   <a :href="`/ticketPrint?${urlLink}`" target="_blank">Go to url</a>

if i apply this way, it works in second click because in first click creates link. So i dont wanna use this way . I want to route it inside my method.

async printData(){
......
 await this.$router.push(this.urlLink)
}

Sure i want to open this in blank page. and i create this new page based url query informations.

3
Not sure what printData is used for, here. - kissu
it is just method. I get necessary informations and and create a link in this method. when page changed i create a pdf page based url informations - oktay tontaş

3 Answers

0
votes

You need to use a nuxt-link here and you can pass it any regular VueJS router-link options to it.

The target=_blank should be fine.

<nuxt-link:to="`/ticketPrint?${urlLink}`">Home page</nuxt-link>
0
votes

If your page is internal use this way:

<template>
  <NuxtLink to="/" target="_blank">Home page</NuxtLink>
</template>

If it is an external link:

<a href="https://nuxtjs.org" target="_blank">External Link to another page</a>

See the nuxtjs documentation!

I hope it helped you!

0
votes

I found a solution


                let routeData = this.$router.resolve({
                    path: '/getTicketPage',
                    query: {ticketNumber : ticketNumber , orderNumber : orderNumber}
                }); 
 
                window.open(routeData.href, '_blank');