Unknown custom element did you register the component correctly

r囧r小猫 2022-05-08 11:46 341阅读 0赞

1、错误描述

70

  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. found in
  3. ---> <Container> at src/components/Container.vue
  4. <App> at src/App.vue
  5. <Root>

2、错误原因

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

3、解决办法

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

发表评论

表情:
评论列表 (有 0 条评论,341人围观)

还没有评论,来说两句吧...

相关阅读