vue中路由以及动态路由跳转

路由跳转

第一种:

<router-link to='需要跳转到的页面的路径‘>
//浏览器在解析时,将它解析成一个类似于<a> 的标签。

第二种

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

动态路由(可传递参数)

this.$router.push({path: 'goodsDetails/',query:{productId: id}})

获取路由参数

this.$route.query.productId

 

 

 

 

猜你喜欢

转载自www.cnblogs.com/wangshengli520/p/10874548.html