Vue 路由内存溢出错误(Maximum call stack size exceeded)

Vue 路由内存溢出错误

[Vue warn ]Error in nextTick: "RangeError: Maximum call stack size exceeded"

在这里插入图片描述
原因:

  • Vue的路由配置错误,
  • 引入的文件包与自己新建的vue文件名字重复(我的原因)
  • 自己新建的vue文件名字重复

方案

  • 检查一下自己配置的路由能否映射自己写的vue文件
  • 更改自己创建的vue文件名(唯一)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Vue由跳转时,如果出现"RangeError: Maximum call stack size exceeded"错误,通常是由于由配置或由导航守卫中的无限循环导致的。这种错误通常发生在以下情况下: 1. 由配置中的循环引用:检查你的由配置文件,确保没有出现循环引用的情况。例如,A页面跳转到B页面,B页面又跳转回A页面。 2. 由导航守卫中的无限循环:检查你的由导航守卫(beforeEach、beforeRouteEnter等),确保没有出现无限循环的情况。例如,在beforeEach中无限次地调用next()。 解决这个问题的方法是: 1. 检查由配置文件,确保没有出现循环引用的情况。 2. 检查由导航守卫,确保没有出现无限循环的情况。 3. 如果以上方法都没有解决问题,可以尝试使用Vue开发者工具进行调试,查看由跳转的具体过程,以便找到问题所在。 范例:<<引用:router/index.js, router.beforeEach((to, from, next) => { if (to.path === '/login') { next(); } else { if (!localStorage.getItem('token')) { next('/login'); } else { next(); } }})。引用:router/index.js, router.beforeEach((to, from, next) => { if (to.path === '/login') { next(); } else { if (!localStorage.getItem('token')) { next('/login'); } else { next(); } }})。 以下是两种可能导致"RangeError: Maximum call stack size exceeded"错误的示例: 1. 由配置中的循环引用 ```javascript // router/index.js const routes = [ { path: '/a', component: A, children: [ { path: '/b', component: B } ] }, { path: '/b', component: B, children: [ { path: '/a', component: A } ] } ] ``` 2. 由导航守卫中的无限循环 ```javascript // router/index.js router.beforeEach((to, from, next) => { if (to.path === '/login') { next(); } else { if (!localStorage.getItem('token')) { next('/login'); } else { next(); } } }) ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值