1.路由标签跳转
<router-link :to="{path, params, query}"></router-link>
path表示跳转的路径
name表示跳转路由名称
2.函数操作(params方式传参)
// 对象写法
this.$router.push({
name: 'router name',
params: {
key: value
...
}
})
// 字符串写法
this.$router.push('/index/page1)
3.函数操作(query方式传参)
// 对象写法
this.$router.push({
name: 'router name',
query: {
key: value
...
}
})
// 字符串写法
this.$router.push('/index/page1?param1=param1¶m2=param2')
网友评论