zoukankan      html  css  js  c++  java
  • [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);
    

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

  • 相关阅读:
    电子商务测试点总结
    pc 端 测试点总结
    web测试点总结
    Monkey脚本API
    Git 命令
    配置samba的流程
    scrapy使用指南
    链接
    顺序表总结
    python数据类型——字符串类型
  • 原文地址:https://www.cnblogs.com/niuben/p/14763546.html
Copyright © 2011-2022 走看看