Difference between revisions of "Vuelinksnip"
Jump to navigation
Jump to search
(Created page with "<pre> // this is in the route.js file { path: 'user/:id', component: User}, // to get the info <template> <p>Loaded ID:{{id}}</p> </template> <script> export default { data(...") |
|||
| Line 2: | Line 2: | ||
// this is in the route.js file | // this is in the route.js file | ||
{ path: 'user/:id', component: User}, | { path: 'user/:id', component: User}, | ||
--------------------- | |||
header has the link with the id | |||
<router-link to="/user/10" tag="li" active-class="active"> <a>User1</a> </router-link> | |||
--------------------------------------- | |||
// to get the | |||
// to get the id passed from the header file | |||
<template> | <template> | ||
<p>Loaded ID:{{id}}</p> | <p>Loaded ID:{{id}}</p> | ||
Revision as of 23:51, 17 October 2018
// this is in the route.js file
{ path: 'user/:id', component: User},
---------------------
header has the link with the id
<router-link to="/user/10" tag="li" active-class="active"> <a>User1</a> </router-link>
---------------------------------------
// to get the id passed from the header file
<template>
<p>Loaded ID:{{id}}</p>
</template>
<script>
export default {
data(){
return{
id: this.$route.params.id
}
}
</script>