vue2中路由跳转页面 this.$router.push() 的用法

作用:this.$router.push() 可以通过修改url实现路由跳转。

注:push 后面可以是对象,也可以是字符串:

1、字符串

this.$router.push('/home/first')

2、对象

this.$router.push({ path: '/home/first' })

3、命名的路由

this.$router.push({ name: 'home', params: { userId: wise }})

4其他this.$router方法:

举例:提交表单时路由跳转:
在这里插入图片描述


版权声明:本文为qq_43115985原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。