vue 中 this.$router.push() 路由跳转传参 及 参数接收的方法
params传参
注意:由于动态路由也是传递params的,所以在 this.$router.push() 方法中 path 不能和 params 一起使用,否则params将无效,需要用name来指定页面
var _this = this;
_this.$router.push({name:'makingPage', params: {result: _this.pngResult}})
// 个人理解为: params需要作为一个对象,否则传参会丢失直接empty
Query传参
无需考虑path问题
var _this = this;
_this.$router.push({path:'/makingPage', query: {result: _this.pngResult}})
取值
this.$route.query.result
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。