The method of passing parameters between vue-router2.0 components and obtaining dynamic parameters, vue-router2.0
1. Tag
<li v-for=" el in hotLins" > <router-link :to="{path:'details',query: {id:el.tog_line_id}}">
2. When you need to pass dynamic parameters in a component, the example above can be used.
<router-link :to="{path:'details',query: {id:el.tog_line_id}}">
3. The parameter id in the query is the parameter to be passed in. The method obtained in the component is:
created: function() { var id = this.$route.query.id; this.getData(id); },
4. As mentioned above, this. $ route. query. id can be used to obtain this parameter, or this. $ root. id = id; can be used to pass the parameter to the parent component.
// Root component constructor var vm = Vue. extend ({router: router, data: function () {return {id: '000000' // city event details id }}});
5. Define the id in data, and then use props to pass the parameter in the child component.
props: { id: { type: String, required: true } },
6. In router-view, pass this parameter:
<router-view :id="id" :order-info="orderInfo"></router-view>
Note that order-info is used here.
The above vue-router2.0 components between passing parameters and obtain dynamic parameters is small make up to share with you all the content, hope to give you a reference, also hope you can support a lot of help home.