由于动态路由也是传递params的,所以在 this.$router.push() 方法中path不能和params一起使用,否则params将无效。
需要用name来指定页面。并通过路由配置的name属性访问
例如:
通过name获取页面,传递params:
this.$router.push({
name: "ProductList",
params: { type: "2" },
});
在name为ProductList的目标页面通过this.$route.params获取参数:
created() {
this.tableFrom.type = this.$route.params.type || "0";
},
© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...

