1 http://localhost:8000?name=John&email=john@gmail.com
2
3 parameters = this.$route.query
4 console.log(parameters)
5
6 name = this.$route.query.name
7 console.log(name)
1//we can configure the routes to receive data via the url
2//first configure the route so it can receive data:
3
4const routes=[
5.
6.
7{path : '/page/:id?', name='page', component: Page},
8.
9.
10
11//inside the Page component we can get the data:
12
13 name:'Page',
14 mounted(){
15 this.url_data=this.$route.params.id;
16 },
17 data(){
18 return{
19 url_data: null
20 };
21 }
22
23
24 //the data can be then used in the template section of the component
25 <h2> {{url_data}}</h2>
1<router-link :to="{ name: 'movie', params: { id: item.id } }">{{ item.title }}</router-link>
2
1const resolved = this.$router.resolve({
2 name: 'SomeRouteName',
3 params: { id: item.id }
4})
5resolved.href // '/some-route-name/:id'