[Vue warn]: Unknown custom element: did you register the component correctly?

Posted 牛奔

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Vue warn]: Unknown custom element: did you register the component correctly?相关的知识,希望对你有一定的参考价值。

前言

[Vue warn]: Unknown custom element:  did you register the component correctly? For recursive components, make sure to provide the "name" option.

问题原因是:使用了相关组件,但没有引入

解决思路

首先找出引起报错的相关代码,查看有没有使用类似组件,例如使用了 radio-groupradio组件,但是没有引入,这时候就会出现上面的错误

 <el-form-item label="状态:">
      <el-radio-group v-model="formData.status">
            <el-radio :key="item.value"
            :label="item.value"
            v-for="item in statusOptions" >{{item.label}}</el-radio>
      </el-radio-group>
</el-form-item>

在项目目录中找到 main.js,然后 import {} from引入相关组件,再 Vue.use()使用即可,例如:

import {
    Radio,
    RadioGroup,
} from \'element-ui\';

Vue.use(Radio);
Vue.use(RadioGroup);

这样就完成了组件的全局引入

以上是关于[Vue warn]: Unknown custom element: did you register the component correctly?的主要内容,如果未能解决你的问题,请参考以下文章

[Vue warn]: Unknown custom element: <Top> - did you register the component correctly?

[Vue warn]: Unknown custom element: <todo-item> - did you register the component correctly?

[Vue warn]: Unknown custom element: – did you register the component correctly? 详细查错思路

[Vue warn]: Unknown custom element: – did you register the component correctly? 详细查错思路

如何修复此错误 [Vue warn]: Unknown custom element: <nuxt-link> in unit testing with Jest

DataTables warning: table id=DataTables_Table_0 - Requested unknown paramete