vue.runtime.esm.js:619 [Vue warn]: Injection “elForm” not found

背景:

当调试一个Vue项目时,出现了该错误信息,详细错误如下:

vue.runtime.esm.js:619 [Vue warn]: Injection "elForm" not found
 found in
 --->  at packages/form/src/form-item.vue
         at packages/tabs/src/tab-pane.vue
           at packages/tabs/src/tabs.vue
             at packages/dialog/src/component.vue
               at src/views/manage/carsend.vue
                 at src/layout/components/AppMain.vue
                   at src/layout/index.vue
                     at src/App.vue
                      
 warn @ vue.runtime.esm.js:619
 resolveInject @ vue.runtime.esm.js:2477
 initInjections @ vue.runtime.esm.js:2427
 Vue._init @ vue.runtime.esm.js:4999
 VueComponent @ vue.runtime.esm.js:5148
 createComponentInstanceForVnode @ vue.runtime.esm.js:3283
 init @ vue.runtime.esm.js:3114
 createComponent @ vue.runtime.esm.js:5972
 createElm @ vue.runtime.esm.js:5919
 createChildren @ vue.runtime.esm.js:6047
 createElm @ vue.runtime.esm.js:5948
 patch @ vue.runtime.esm.js:6471
 Vue._update @ vue.runtime.esm.js:3939
 updateComponent @ vue.runtime.esm.js:4060
 get @ vue.runtime.esm.js:4473
 Watcher @ vue.runtime.esm.js:4462
 mountComponent @ vue.runtime.esm.js:4067
 ./node_modules/vue/dist/vue.runtime.esm.js.Vue.$mount @ vue.runtime.esm.js:8409
 init @ vue.runtime.esm.js:3118
 createComponent @ vue.runtime.esm.js:5972
 createElm @ vue.runtime.esm.js:5919
 createChildren @ vue.runtime.esm.js:6047
 createElm @ vue.runtime.esm.js:5948
 createChildren @ vue.runtime.esm.js:6047
 createElm @ vue.runtime.esm.js:5948
 patch @ vue.runtime.esm.js:6471
 Vue._update @ vue.runtime.esm.js:3939
 updateComponent @ vue.runtime.esm.js:4060
 get @ vue.runtime.esm.js:4473
 Watcher @ vue.runtime.esm.js:4462
 mountComponent @ vue.runtime.esm.js:4067
 ./node_modules/vue/dist/vue.runtime.esm.js.Vue.$mount @ vue.runtime.esm.js:8409
 init @ vue.runtime.esm.js:3118
 createComponent @ vue.runtime.esm.js:5972
 createElm @ vue.runtime.esm.js:5919
 createChildren @ vue.runtime.esm.js:6047
 createElm @ vue.runtime.esm.js:5948
 updateChildren @ vue.runtime.esm.js:6210
 patchVnode @ vue.runtime.esm.js:6313
 updateChildren @ vue.runtime.esm.js:6187
 patchVnode @ vue.runtime.esm.js:6313
 patch @ vue.runtime.esm.js:6476
 Vue._update @ vue.runtime.esm.js:3942
 updateComponent @ vue.runtime.esm.js:4060
 get @ vue.runtime.esm.js:4473
 run @ vue.runtime.esm.js:4548
 flushSchedulerQueue @ vue.runtime.esm.js:4304
 (anonymous) @ vue.runtime.esm.js:1980
 flushCallbacks @ vue.runtime.esm.js:1906
 Promise.then (async)
 timerFunc @ vue.runtime.esm.js:1933
 nextTick @ vue.runtime.esm.js:1990
 queueWatcher @ vue.runtime.esm.js:4396
 update @ vue.runtime.esm.js:4538
 notify @ vue.runtime.esm.js:730
 reactiveSetter @ vue.runtime.esm.js:1055
 proxySetter @ vue.runtime.esm.js:4625
 resetForm @ carsend.vue?382c:535
 handleCreate @ carsend.vue?382c:578
 invokeWithErrorHandling @ vue.runtime.esm.js:1854
 invoker @ vue.runtime.esm.js:2179
 invokeWithErrorHandling @ vue.runtime.esm.js:1854
 Vue.$emit @ vue.runtime.esm.js:3882
 handleClick @ element-ui.common.js:9417
 invokeWithErrorHandling @ vue.runtime.esm.js:1854
 invoker @ vue.runtime.esm.js:2179
 original._wrapper @ vue.runtime.esm.js:6911
 Show 19 more frames
 vue.runtime.esm.js:619 [Vue warn]: Property or method "elForm" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
 found in
 --->  at packages/form/src/form-item.vue
         at packages/tabs/src/tab-pane.vue
           at packages/tabs/src/tabs.vue
             at packages/dialog/src/component.vue
               at src/views/manage/carsend.vue
                 at src/layout/components/AppMain.vue
                   at src/layout/index.vue
                     at src/App.vue
                      
 warn @ vue.runtime.esm.js:619
 warnNonPresent @ vue.runtime.esm.js:2015
 get @ vue.runtime.esm.js:2070
 form_itemvue_type_template_id_b6f3db6c_render @ element-ui.common.js:23082
 Vue._render @ vue.runtime.esm.js:3542
 updateComponent @ vue.runtime.esm.js:4060
 get @ vue.runtime.esm.js:4473
 Watcher @ vue.runtime.esm.js:4462
 mountComponent @ vue.runtime.esm.js:4067
 ./node_modules/vue/dist/vue.runtime.esm.js.Vue.$mount @ vue.runtime.esm.js:8409
 init @ vue.runtime.esm.js:3118
 createComponent @ vue.runtime.esm.js:5972
 createElm @ vue.runtime.esm.js:5919
 createChildren @ vue.runtime.esm.js:6047
 createElm @ vue.runtime.esm.js:5948
 patch @ vue.runtime.esm.js:6471
 Vue._update @ vue.runtime.esm.js:3939
 updateComponent @ vue.runtime.esm.js:4060
 get @ vue.runtime.esm.js:4473
 Watcher @ vue.runtime.esm.js:4462
 mountComponent @ vue.runtime.esm.js:4067
 ./node_modules/vue/dist/vue.runtime.esm.js.Vue.$mount @ vue.runtime.esm.js:8409
 init @ vue.runtime.esm.js:3118
 createComponent @ vue.runtime.esm.js:5972
 createElm @ vue.runtime.esm.js:5919
 createChildren @ vue.runtime.esm.js:6047
 createElm @ vue.runtime.esm.js:5948
 createChildren @ vue.runtime.esm.js:6047
 createElm @ vue.runtime.esm.js:5948
 patch @ vue.runtime.esm.js:6471
 Vue._update @ vue.runtime.esm.js:3939
 updateComponent @ vue.runtime.esm.js:4060
 get @ vue.runtime.esm.js:4473
 Watcher @ vue.runtime.esm.js:4462
 mountComponent @ vue.runtime.esm.js:4067
 ./node_modules/vue/dist/vue.runtime.esm.js.Vue.$mount @ vue.runtime.esm.js:8409
 init @ vue.runtime.esm.js:3118
 createComponent @ vue.runtime.esm.js:5972
 createElm @ vue.runtime.esm.js:5919
 createChildren @ vue.runtime.esm.js:6047
 createElm @ vue.runtime.esm.js:5948
 updateChildren @ vue.runtime.esm.js:6210
 patchVnode @ vue.runtime.esm.js:6313
 updateChildren @ vue.runtime.esm.js:6187
 patchVnode @ vue.runtime.esm.js:6313
 patch @ vue.runtime.esm.js:6476
 Vue._update @ vue.runtime.esm.js:3942
 updateComponent @ vue.runtime.esm.js:4060
 get @ vue.runtime.esm.js:4473
 run @ vue.runtime.esm.js:4548
 flushSchedulerQueue @ vue.runtime.esm.js:4304
 (anonymous) @ vue.runtime.esm.js:1980
 flushCallbacks @ vue.runtime.esm.js:1906
 Promise.then (async)
 timerFunc @ vue.runtime.esm.js:1933
 nextTick @ vue.runtime.esm.js:1990
 queueWatcher @ vue.runtime.esm.js:4396
 update @ vue.runtime.esm.js:4538
 notify @ vue.runtime.esm.js:730
 reactiveSetter @ vue.runtime.esm.js:1055
 proxySetter @ vue.runtime.esm.js:4625
 resetForm @ carsend.vue?382c:535
 handleCreate @ carsend.vue?382c:578
 invokeWithErrorHandling @ vue.runtime.esm.js:1854
 invoker @ vue.runtime.esm.js:2179
 invokeWithErrorHandling @ vue.runtime.esm.js:1854
 Vue.$emit @ vue.runtime.esm.js:3882
 handleClick @ element-ui.common.js:9417
 invokeWithErrorHandling @ vue.runtime.esm.js:1854
 invoker @ vue.runtime.esm.js:2179
 original._wrapper @ vue.runtime.esm.js:6911
 Show 23 more frames
 vue.runtime.esm.js:619 [Vue warn]: Error in render: "TypeError: Cannot read property '$options' of undefined"
 found in
 --->  at packages/form/src/form-item.vue
         at packages/tabs/src/tab-pane.vue
           at packages/tabs/src/tabs.vue
             at packages/dialog/src/component.vue
               at src/views/manage/carsend.vue
                 at src/layout/components/AppMain.vue
                   at src/layout/index.vue
                     at src/App.vue
                      

解决办法:

从错误信息中,可以看出 elForm 未找到,用过Element-UI的同学都知道,

如果觉得文章有帮助到你,可以扫描以下二维码
   请本文作者 喝一杯
pay_weixin pay_weixin

发表评论

电子邮件地址不会被公开。 必填项已用*标注