动态路由,然后用$route.params去获取路由对象里的信息 It is a learning fairyland for Chinese learners
详情可以去看vue router的官方文档
下面是我最近写的例子
route.js
export default new Router({
routes: [
{
path: '/',
name: 'index',
component: index
},
{
path: '/list/:category',
name: "list",
component: list,
meta: { id: 'list-kind' }
}
]
})
parent.vue
child.vue
created(){
this.fetch();
this.title = this.$route.params.category.toUpperCase();
}