环境
"vue": "^1.0.14"
"vue-router": "0.7.13",
路由1
'/about/:aa': {
name: 'about',
component: require('./components/about.vue')
},
跳转1
this.$router.go({name: 'about', params: {aa: 11}});
结果1
以下方式,能够使用{{$route.params.aa}}
获取到值。
路由2
'/about': {
name: 'about',
component: require('./components/about.vue')
},
跳转2
this.$router.go({name: 'about', params: {aa: 11}});
结果2
那么{{$route.params.aa}}
获取不到值。
query
方式能够传递一个对象,但是会拼接在URL上面。
期望
如果我想通过params
传递一个对象,应该如何使用?
绑定
params
就能够把参数直接传入,还可以绑定自定义事件callback
,用于回调。