傳遞參數的方法:
1.Params
由於動態路由也是傳遞params的,所以在 this.$router.push() 方法中 path不能和params一起使用,否則params將無效。需要用name來指定頁面。
及通過路由配置的name屬性訪問
在路由配置文件中定義參數:
通過name獲取頁面,傳遞params:
在目標頁面通過this.$route.params獲取參數:
2.Query
頁面通過path和query傳遞參數,該實例中row為某行表格數據
在目標頁面通過this.$route.query獲取參數:
this.$route.query.row。xxx