一、路由跳转
this.$router.push('跳转的url)
二、路由带参传值跳转
- 参数不在地址栏中显示
例:http://跳转的URL
const pageValue = {
id: this.id
}
this.$router.push({
path: '页面的路径',
name: '页面的名字',
params: pageValue,
})
- 参数在地址栏中显示
例: http://跳转的URL?id=5
const pageValue = {
id: this.id
}
this.$router.push({
path: '页面的路径',
name: '页面的名字',
query: pageValue,
})
三、获取路由传的值
id = this.$route.params.id
id = this.$route.query.id