第一種 params 傳參
patams傳參,路徑不能使用path
this.$router.push({name: 'index', params: {type: 1}})
獲取數據:this.$route.params.type
第二種 query
this.$router.push({path: '/user/index', query: {type: 1}})
獲取數據: 取數據:this.$route.query.type
注意:
params傳參,push里面只能是 name:'xxxx',不能是path:'/xxx',因為params只能用name來引入路由,如果這里寫成了path,接收參數頁面會是undefined!!!
