我现在很高兴与路由器合作.我想导航到另一个页面,我使用以下代码:
this.$router.push({path: '/newLocation', params: { foo: "bar"}});
Run Code Online (Sandbox Code Playgroud)
然后我希望它在新的组件上
this.$route.params
Run Code Online (Sandbox Code Playgroud)
这不起作用.我也尝试过:
this.$router.push({path: '/newLocation'});
this.$router.push({params: { foo: "bar"}});
Run Code Online (Sandbox Code Playgroud)
我已经检查了一下源代码并注意到这个属性被新对象{}覆盖了.
我想知道params的使用是否超出我的想法?如果没有,怎么用呢?
提前致谢