vue中route和router区别

1, route 当前路由信息

只读为主,你用它来获取path / name / params / query / hash / meta / matched

// 读当前路由参数
this.$route.params.id
this.$route.query.keyword
this.$route.path

2, router 路由器实例(“怎么跳转、怎么管理路由”)

this.$router.push({ name: 'detail', params: { id: 1 } })
this.$router.replace('/login')
this.$router.back()

posted @ 2025-12-26 15:56  学无边涯  阅读(0)  评论(0)    收藏  举报