0

I’m having a problem. I can’t get it to work.

I have this component called Projet. Inside of it, I have this block of code:

i want when i click in project it will take me to another detailpage but nothing happen:

{path: '/detail/:id', component: detail}

and this the code in my components

        <tr v-for="projet in projets" :key="projet.id" >
           <router-link :to="{ name: 'detail', params: {id:  projet.id } }" style="text-decoration:none; color:black;">        <td>{{ projet.name }}</td></router-link>
                  <td>{{ projet.owner }}</td>
                  <td>{{ projet.durre }}</td>

                  <td>-------</td>
                  <td><i  data-toggle="modal" data-target="#description" class="fas fa-scroll" ></i></td>
                  <td>{{projet.budget}}</td>
                  <td>      <a href="#" @click="deleteProjet(projet.id)" ><i class="fas fa-trash-alt"></i></a>

2 Answers 2

1

I think you missed the router name.

try this

{path: '/detail/:id', component: detail, name: 'detail'}
Sign up to request clarification or add additional context in comments.

6 Comments

then make a log of your project @anis
project.id work he take me to other page but there is no id in the url of the new page
if projet.id not found then it will show undefined. and you will redirect to /detail/undefined page
127.0.0.1:8000/… take me to this url
your templates not compiling, check vue instance, vue files. and see in your console log
|
0

Try this:


<router-link :to="'detail/' + projet.id" style="text-decoration:none; color:black;">     

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.