一般正常 根据官网提供的 用
npm i element-ui -S
安装
vue main.js 引入
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
createApp(App).use(store).use(router).use(ElementUI).mount('#app')
运行结果 空白页面
控制台打印报错
报错原因是因为 从Vue3.0不支持Element UI,改成了Element Plus
重新 npm i element-plus --save
然后 main.js 引入
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-plus'
import 'element-plus/lib/theme-chalk/index.css'
createApp(App).use(store).use(router).use(ElementUI).mount('#app')
npm run serve 成功运行