Vue - Redirected when going from “/login?redirect=%2Fdashboard“ to “/dashboard“ via a navigation
Vue to from when navigation via login Dashboard
2023-09-11 14:15:54 时间
报错原因
permission.js
中 next({ ...to, replace: true })
会被认为是一个失败的 navigation
,
虽然能导航成功,但不再是原来的 to
,所以 login
里的 push()
返回一个 rejected Promise
。
Error: Redirected when going from “/login?redirect=%2Fdashboard“ to “/dashboard“ via a navigation
解决方案
以下两种方案,请根据实际情况选择。
一、在 push()
后面接一个 .catch(()=>{})
,如下代码所示:
// 避免eslint报错需要添加 "eslint-disable-line"
this.$router.push({
相关文章
- vue - Vue介绍
- 【Vue】你必须要知道的vue中v-on指令的修饰符
- Laravel + Vue + element-ui 【前端项目一】vue 实现查看更多 5
- Failed to load config "lugin:vue/essenti al" to extend from.
- 启动简单的springboot项目报错:To display the conditions report re-run your..Web server failed to start
- 【前端】vue Failed to resolve component If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
- vue动态style el-table-column 状态 颜色
- vue被部署到子(二级)目录
- 详解ESLint在Vue中的使用小结
- vue实现商品上下架功能(状态值随之改变)
- Vue中作用域插槽的使用
- vue 发送ajax请求
- nginx下载 并将vue项目部署上去
- vue-cli3运行本地项目后,端口不随设置的随便变化
- Vue子组件向父组件传值(this.$emit()方法)
- vue 登录页背景-粒子特效(Vue-Particles)