zoukankan      html  css  js  c++  java
  • Unknown custom element did you register the component correctly

    错误描述:

    1 vue.esm.js?efeb:591 [Vue warn]: Unknown custom element: <el-container> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
    2  
    3 found in
    4  
    5 ---> <Container> at src/components/Container.vue
    6        <App> at src/App.vue

    2、错误原因

          没有在main.js文件中注册这个组件,导致出现了报错

    3、解决办法

          在main.js中注册Container组件

     1 // The Vue build version to load with the `import` command
     2 // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
     3 import Vue from 'vue'
     4 import ElementUI from 'element-ui'
     5 import 'element-ui/lib/theme-chalk/index.css'
     6 import App from './App'
     7 import router from './router'
     8 import Container from '@/components/Container';
     9  
    10 Vue.config.productionTip = false
    11 Vue.use(ElementUI)
    12  
    13 /* eslint-disable no-new */
    14 new Vue({
    15   el: '#app',
    16   router,
    17   components: { App,Container },
    18   template: '<App/>'
    19 })

    但是用了之后,还是不行,于是乎去了element-ui的官网

    博主用的是按需引用,这边本地没有插件,所以采用了整体引入

     1 // The Vue build version to load with the `import` command
     2 // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
     3 import Vue from 'vue'
     4 import App from './App'
     5 import router from './router'
     6 import ElementUI from 'element-ui'
     7 import 'element-ui/lib/theme-chalk/index.css';
     8 
     9 Vue.config.productionTip = false
    10 
    11 Vue.use(ElementUI)
    12 /* eslint-disable no-new */
    13 new Vue({
    14   el: '#app',
    15   router,
    16   components: { App},
    17   template: '<App/>'
    18 })

    本文转自:https://blog.csdn.net/you23hai45/article/details/83014831

  • 相关阅读:
    将一个dropdownlist从一个div复制到另一个div
    【转】AOP 那点事儿(续集)
    【转】AOP 那点事儿
    spring 简单配置
    spring 基础原理
    jvm简介
    jre、jdk和jvm的关系
    【转】Jvm工作原理
    servlet简述
    Filter简述
  • 原文地址:https://www.cnblogs.com/minmin123/p/13560814.html
Copyright © 2011-2022 走看看