解决vue-cli 项目引入element ui 运行时浏览器报错Unknown custom element

解决vue-cli 项目引入element ui 运行时浏览器报错Unknown custom element

上条动态的问题解决了,在main.js文件里加入下面的代码即可

import Vue from 'vue';
import App from './App';

import router from './router';

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(router);
Vue.use(ElementUI);

new Vue({
  el: '#app',
  router,
  render: h => h(App) // ElementUI
})

之前我写错了,Vue.use(ElementUI)我给写成了Vue.use(‘ElementUI’),导致运行时报错Unknown custom element…
组件名不需要加引号,害,手欠点到了,写代码一定要仔细仔细再仔细,刚发现自己这个错误,写条博客记录一下哈哈。

猜你喜欢

转载自blog.csdn.net/qq_45745643/article/details/106306229