1
votes

I thought this would work:

  { path: '/course/:id', component: Course.extend({
    props: { course: params.id }
  }) },

Sadly, it's not that simple (it's not id either). How do I do this? (I just took a course on vue, can't believe I can't remember this)

1

1 Answers

2
votes

As it is in the docs, you have to make props option true in the routes, see below code to understand it:

const User = {
  props: ['id'],
  template: '<div>User {{ id }}</div>'
}
const router = new VueRouter({
  routes: [
    { path: '/user/:id', component: User, props: true }
  ]
})