連接:https://www.cnblogs.com/zhangruiqi/p/9412539.htmlhtml
傳參: this.$router.push({ path:'/xxx' query:{ id:id } }) 接收參數: this.$route.query.id
傳參: this.$router.push({ name:'xxx' params:{ id:id } }) 接收參數: this.$route.params.id
注意:params傳參,push裏面只能是 name:'xxxx',不能是path:'/xxx',由於params只能用name來引入路由,若是這裏寫成了path,接收參數頁面會是undefined!!!
post
注意:傳參是this.$router,接收參數是this.$route,這裏千萬要看清了!!!
3. this.$router 和this.$route有何區別?ui
在控制檯打印二者能夠很明顯的看出二者的一些區別:this