I have table with users datas in vue bootstrap. I'm using Vue Router to go on user profile page too. Profile pages path is /user/idNumber and I want to route it under Name. Something like this:
<a href="/users/idNumber"> Name </a>
How I can do that?
Code:
<b-table striped hover :items="usersList" :fields="fields">
<template v-slot:cell(_id)="data">
<router-link :to="`/user/${data.value}`">{{ data.value }}</router-link>
</template>
<template v-slot:cell(fullname)="data">
<router-link :to="`/user/${data.value}`">{{ data.value }}</router-link>
</template>
</b-table>
usersList:
[{"_id":"5df9663acf06e2001742ac17","name":"Retdadada5155465","lastname":"Nienow","email":"[email protected]","age":"1995","gender":"female","weight":58,"height":166,"activity":1.4,"value":3,"_createdOn":"2019-12-17T23:35:22.339Z","_updatedOn":"2019-12-19T20:57:30.588Z"},{"_id":"5df842f2cf06e2001742a8ec","name":"Retdadada516","lastname":"Nienow","email":"[email protected]","age":"1993","gender":"female","weight":58,"height":166,"activity":1.4,"value":3,"_createdOn":"2019-12-17T02:52:34.183Z","_updatedOn":"2019-12-19T20:57:42.352Z"},{"_id":"5df7c972bca42200177decb4","name":"Lue","lastname":"Schneider","email":"[email protected]","age":"1997","gender":"female","weight":60,"height":180,"activity":1.6,"_createdOn":"2019-12-16T18:14:10.554Z","_updatedOn":"2019-12-19T20:57:51.550Z"}]'
fields:
["_id",
{
key: "fullname",
label: "Fullname",
sortable: true,
formatter: (value, key, item) => {
return item.name + " " + item.lastname
},
},
{
key: "birthYear",
label: "Age: ",
sortable: true,
formatter: (value, key, item) => {
return new Date().getFullYear() - item.age
},
},
],
Regards
userListandfieldslooks like ?