在vue傳值的時候有的不想把所傳值顯示在地址欄中,vue跳轉頁面傳參有兩種方式params傳參和query傳參。
params 傳參 : 相當於post請求,頁面跳轉時參數不會在地址欄中顯示:
this.$router.push({path:"",params:{id:id}})
接收參數:this.$route.params.id
query 傳參 : 相當於get請求,頁面跳轉時參數會在地址欄中顯示:
this.$router.push({path:"",query:{id:id}})
接收參數:this.$route.query.id