明明下载了vue-router报未定义?

在尝试创建vue-router实例时遇到错误,问题源于vue-router版本过高(4.0.16)。解决方案是将vue-router版本降低到3.2.0,确保与vue(2.6.14)版本兼容。修改package.json文件以确认降级后的版本。

明明下载了vue-router报未定义?

在使用vue:"^2.6.14"版本 创建vue-router实例的时候报了一下的错误

我这里装的vue-router版本 “vue-router”: “^4.0.16”

在这里插入图片描述

只要降低vue-router的版本就行了 (vue-router@3.2.0) 其他版本可以自行尝试

降完版本别忘了去pakeage.json里查看降低过后的版本号

在这里插入图片描述

Unhandled error during execution of component update at <RouterView> at <AppView> at <ElScrollbar class="v-layout-content-scrollbar !h-[calc(100%-var(--top-tool-height)-var(--tags-view-height))] mt-[calc(var(--top-tool-height)+var(--tags-view-height))]" > at <Layout class="" onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object) {…} > > at <RouterView class="" > at <ElConfigProvider namespace="el" locale= {name: &#39;zh-cn&#39;, el: {…}} message= {max: 1} ... > at <ConfigGlobal size="default" > at <App> warn$1 @ chunk-TNWDQVRG.js?v=6644a7ff:2116 logError @ chunk-TNWDQVRG.js?v=6644a7ff:2327 handleError @ chunk-TNWDQVRG.js?v=6644a7ff:2319 callWithErrorHandling @ chunk-TNWDQVRG.js?v=6644a7ff:2265 flushJobs @ chunk-TNWDQVRG.js?v=6644a7ff:2471 Promise.then queueFlush @ chunk-TNWDQVRG.js?v=6644a7ff:2385 queuePostFlushCb @ chunk-TNWDQVRG.js?v=6644a7ff:2399 queueEffectWithSuspense @ chunk-TNWDQVRG.js?v=6644a7ff:9399 baseWatchOptions.scheduler @ chunk-TNWDQVRG.js?v=6644a7ff:8279 effect2.scheduler @ chunk-TNWDQVRG.js?v=6644a7ff:2009 trigger @ chunk-TNWDQVRG.js?v=6644a7ff:509 endBatch @ chunk-TNWDQVRG.js?v=6644a7ff:567 notify @ chunk-TNWDQVRG.js?v=6644a7ff:827 trigger @ chunk-TNWDQVRG.js?v=6644a7ff:801 set value @ chunk-TNWDQVRG.js?v=6644a7ff:1673 finalizeNavigation @ vue-router.js?v=6644a7ff:2517 (anonymous) @ vue-router.js?v=6644a7ff:2427 Promise.then pushWithRedirect @ vue-router.js?v=6644a7ff:2395 push @ vue-router.js?v=6644a7ff:2321 menuSelect @ Menu.vue:69 callWithErrorHandling @ chunk-TNWDQVRG.js?v=6644a7ff:2263 callWithAsyncErrorHandling @ chunk-TNWDQVRG.js?v=6644a7ff:2270 emit @ chunk-TNWDQVRG.js?v=6644a7ff:8466 (anonymous) @ chunk-TNWDQVRG.js?v=6644a7ff:10175 handleMenuItemClick @ element-plus.js?v=6644a7ff:31222 handleClick @ element-plus.js?v=6644a7ff:31456 callWithErrorHandling @ chunk-TNWDQVRG.js?v=6644a7ff:2263 callWithAsyncErrorHandling @ chunk-TNWDQVRG.js?v=6644a7ff:2270 invoker @ chunk-TNWDQVRG.js?v=6644a7ff:11202
最新发布
09-03
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值