this.$router.push() 的用法

2021-08-19  本文已影响0人  SY

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

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

// 字符串

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

// 对象

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

// 命名的路由

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

上一篇 下一篇

猜你喜欢

热点阅读