1.路由傳值   this.$router.push()

(1) 路由跳轉使用router.push()方法,這個方法會向history棧新增一個新紀錄,所以,當用戶點選瀏覽器後退按鈕時,會回到之前的頁面。

a. 路由跳轉:

this.$router.push('/home');

b. 命名的路由,傳參使用params:

this.$router.push({name:"home", params:{userId: '123'}})

        獲取引數

this.$router.params.userId

  c. 帶查詢的引數, 傳參使用query:

this.$router.push({ path: "/mine", query: { userId: "123" } });

       獲取引數

this$router.query.userId

 注:(1)由於動態路由也是傳遞params的,所以在 this.$router.push() 方法中path不能和params一起使用,否則params將無效。需要用name來指定頁面。

            (2)兩種方式的區別是query傳參的引數會帶在url後邊展示在位址列,params傳參的引數不會展示到位址列。需要注意的是接收引數的時候是route而不是                           router。兩種方式一一對應,名字不能混用