Get route by name and params for vue-router

You are looking for the Router instance’s resolve method:

Given location in form same as used in <router-link/>, returns object with the following resolved properties:

{
  location: Location;
  route: Route;
  href: string;
}

In your case you could do something like this to get the url:

let props = this.$router.resolve({ 
  name: 'ProductDetail',
  params: { id: some_id, slug: some_slug },
});

return props.href;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)