Vue中this.$router.push后params参数为何无法获取?
- 内容介绍
- 文章标签
- 相关推荐
本文共计425个文字,预计阅读时间需要2分钟。
主要通过两种方式传递参数:
1. Query方式传递参数和接收参数: 使用`this.$router.push({ path: '/xxx', query: { idname: id } })`进行跳转,接收参数的方式为`this.$route.query.id`。
2. Params方式传递参数: 使用`this.$router.push({ name: '路径名称', params: { idname } })`进行跳转。
本文共计425个文字,预计阅读时间需要2分钟。
主要通过两种方式传递参数:
1. Query方式传递参数和接收参数: 使用`this.$router.push({ path: '/xxx', query: { idname: id } })`进行跳转,接收参数的方式为`this.$route.query.id`。
2. Params方式传递参数: 使用`this.$router.push({ name: '路径名称', params: { idname } })`进行跳转。

