访问权限不足时,被强制跳转到login,携带next参数,也就是当前的url
that.$router.push({path: '/login', query: {next: '/vip'}});
login页面接收/vip页面传过来的next 参数,赋值给this.next存储
//在这里调用ajax请求方法,页面加载完自动调用
created() {
//接收vip页面 that.$router.push 传过来的参数
this.next = this.$route.query.next
},
当权限足够时,执行跳转回this.next所存的目录
that.$router.push({path: this.next});