ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

vue中route和router区别

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()

返回列表