1.query传参:会把参数拼接在url上
//根据path跳转
this.$router.push({path:'/home',query:{goodsId:'11122'}})
//根据name跳转
this.$router.push({name:'/home',query:{goodsId:'11122'}})
2.params传参:不会把参数拼接在url上
//params传参只能用name跳转
this.$router.push({name:'home',params: {goodsId:'11122'}})
3.不传参
//直接写地址
this.$router.push('/home')
//用name做跳转
this.$router.push({name:'home'})
//用path做跳转
this.$router.push({path:'/home'})
要注意的是传的参数是一个对象,需要有:key和value