1、this.$router.push("detail"):detail为要跳转的路由地址,该方式简单但无法传递参数。
2、this.$router.push({name:"detail",params:{personId:33}}):detail为要跳转的路由地址,params为传递的参数,目标页面可以使用this.$route.params.personId来获取传递的参数,该方式有一个缺点就是在目标页面刷新时传递过来的参数会丢失。
3、this.$router.push({path:"/detail",query:{personId:33}}):detail为要跳转的路由地址,query为传递的参数,目标页面使用this.$route.query.personId来获取传递的参数,该方式会把传递的参数放在url上,如:localhost:8080/#/detail/?personId=33。(该方式也称为地址栏传参)
注意!!!
获取参数是 this.$route.query.** 或者this.$route.params.****
使用this.$router.query.**/params.***是无法获取到参数的
http://blog.xqlee.com/article/814.html