Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
redirection link generate by the methods to href or nuxt-link

Hello I want to display a page with a link generated by a method.
Here is my current code.

<template>
  <nuxt-link :to="seeProduct(item.sku.product.id).toString()">
      <div>
        <span>Go to product</span>
      </div>
  </nuxt-link>
</template>

<script>
export default {
methods: {
  async seeProduct(id) {
    const app = { $axios: this.$axios };
    const urlProduct = await endPoint.getProduct(app, id);
    console.log(urlProduct.url); // https://www.products/gants.html => this is the url
    return urlProduct.url;
    },
  }
}
</script>

When I click on the link, the redirection is not good. How to do a good redirection with an URL generated by a method?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

If it's an internal path, I do recommend you passing an actual path only or even better, a name as shown here: https://router.vuejs.org/guide/essentials/navigation.html#router-push-location-oncomplete-onabort

It should look something like :to="{ name: 'gants' }" when your seeProduct method is done.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!