版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_24147051/article/details/84562700
-
普通跳转页面
const url = “/XXX/YYYYY/MMMMM”;
window.location.href = url ; -
普通跳转打开新页面
const url = “/XXX/YYYYY/MMMMM”;
window.open(url, “_blank”, “”); -
vue页面跳转
// 字符串
this.$router.push(’/home/first’)
// 对象
this.$router.push({ path: ‘/home/first’ })
// 命名的路由(可以传递参数)
this.$router.push({ name: ‘home’, params: { userId: wise }})
-
react页面跳转
第一种:
this.props.router.push(path)
第二种:
this.context.router.push(path)
如果需要传递参数:
this.props.router.push({ pathname : '/', state : { msg : 'you have logined and will redirect to your page'}});
this.context.router.push({ pathname : '/', state : { msg : 'you have logined and will redirect to your page'}});