Vue路由
路由传值的方法和区别
区别
this.$router:VueRouter 的实例,要导航到不同的URL,就要使用$router.push()
this.$route:当前router 跳转的对象,可以获取到name、path、query、params等。
{
path: '/home',
name: 'home',
component: Home
},
传参
使用$router.push 拼接参数传参。
// userName=one 就是传递的参数
this.$router.push('/
转载
2021-07-05 10:36:56 ·
38 阅读 ·
0 评论