方法1:
? this.$router.push()的使用:
1>params傳值方式,必須和name一起使用,否則獲取不到值, 如:
this.$router.push({
? ? ? ? path: '/home',
? ? ? ? params: {
? ? ? ? xxx: 'ddd'
? ? ? ? }
?});
在home頁面取參數值用this.$route.params.xxx;
2> query傳參方式,和path一起使用, 如:
this.$router.push({
? ? ? ? path: '/home',
? ? ? ? query: {
? ? ? ? ? ? xxx: 'ddd'
? ? ? ? }
? ? ? });
在home頁面取參數值用this.$route.query.xxx;
方法2: