Answers for "how to pass path variable and parameter in vuejs"

2

url params vue

//we can configure the routes to receive data via the url
//first configure the route so it can receive data:

const routes=[
.
.
{path : '/page/:id?', name='page', component: Page},
.
.

//inside the Page component we can get the data:

  name:'Page',
  mounted(){
     this.url_data=this.$route.params.id;
    },
  data(){
   return{
     url_data: null
    };
  }
  
  
  //the data can be then used in the template section of the component
  <h2> {{url_data}}</h2>
Posted by: Guest on October-31-2020
0

vuejs pass data to router-view

// App.vue
<router-view name="bookBus" :model="model"></router-view>
// and use model as props in your view
Posted by: Guest on December-21-2020

Code answers related to "how to pass path variable and parameter in vuejs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language