0👍
You can use the dynamic components and pass the id
param as props to your route.
Something like:
const Category = Vue.component('category', {
name: 'category',
template: '#category',
props: ['id']
});
const router = new VueRouter({
routes: [
{ path: '/category/:id', name: 'category', component: Category, props: true },
]
})
and in template:
<template id="category">
<div>
<h3>Category : {{ id }}</h3>
<component :is="id"></component>
</div>
</template>
-1👍
Couldn´t you just make the component itself dynamicly change its content based on the route id?
- [Vuejs]-VueJS + MomentJS: How To Determine Time Progress
- [Vuejs]-Vue.js2 console err is "app.js:2 Uncaught SyntaxError: Unexpected identifier"
Source:stackexchange.com