接收参数
let router = new VRouter({
mode: 'history',
routes: [
{
path: '/apple/:color', //接收参数
name: 'apple',
component: Apple
},{
path:'/banana/:color/detail/:type',
name: 'banana',
component: Banana
}
]
})
读取参数
methods:{
getParam(){
console.log(this.$route.params)
}
}
<div>{{ $route.params.color }}</div>