跳到主内容

vue3在浏览器控制台报错:Uncaught (in promise) TypeError: Cannot read property 'deep' of undefined

· 2分钟阅读

问题

今天碰到一个非常无语,令我哭笑不得的问题,在开发 vue3 项目时,控制台报了以下错误

runtime-core.esm-bundler.js:3320 Uncaught (in promise) TypeError: Cannot read property 'deep' of undefined
at withDirectives (runtime-core.esm-bundler.js:3320)
at Proxy.<anonymous> (index.vue:55)
at renderComponentRoot (runtime-core.esm-bundler.js:761)
at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:4532)
at ReactiveEffect.run (reactivity.esm-bundler.js:160)
at callWithErrorHandling (runtime-core.esm-bundler.js:6988)
————————————————

image.png

这尼玛是什么错误?deep of undefined?,我看项目里面也没有哪个地方用了 deep 变量啊。

原因

经过仔细排查,花了我一天的时间,居然把 v-model 敲成 v-modle 了。。。顿时心中一万只草泥马在崩腾。

image.png

解决

编写代码还是要仔细点,一般 vue 报错,如果里面包含 withDirectives 的错误,一般都是指令的问题,所以可以从这里寻找突破口。行了,洗洗睡吧!

image.png