Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to add router link to to this centered title here.
vue routing - JSFiddle[^]

What I have tried:

<pre><router-link :to="{ name: 'projects.show', params: { slug: project.slug }}">
    <h4>{‌{ project.title}}</h4>
</router-link>
Posted
Updated 17-Apr-20 4:22am
v2
Comments
nikki16 18-Apr-19 4:02am    
here's the updated link
https://jsfiddle.net/nikki65/bf34qahx/1/

1 solution

Suppose we make this router Home in the router file;
{
    path: '/home',
    name: 'Home',
    component: Home
  }


then you can use the router in three ways;

First
In first way use the router name like here router name is 'Home'
<pre><router-link :to="{ name:'Home'}">
    <h4>{‌{ project.title}}</h4>
</router-link>


Second
In second way you can use any tag like button tag etc. and then you can use router like to="/home";
<v-btn to="/home">Home</v-btn>


Third
In third way, you can simply write the router-link and then write the to="/home"
<router-link to="/home">Home</router-link>


Hope you understand...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900