我在GUI里面直接安装插件element,像这样,谁知道引用的时候就报错了,然后我再重新用命令行安装就一直报错,千万不要在如图里面加element插件,卸载又卸载不掉。
然后就重新建了一遍项目,然后我发现目前element-ui只支持Vue2.6以下的版本,如果想在Vue3.0使用这个组件库,就要使用element-plus
以下是安装教程
安装element-plus
npm install element-plus --save
如果有些npm版本过高或者过低的时候下载Echarts的过程中可能会报错,遇到这种问题可以在后面加上 --legacy-peer-deps试试
npm install element-plus --S --legacy-peer-deps
在main.ts或者main.js文件中
//main.js
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus';
import 'element-plus/theme-chalk/index.css';
import locale from 'element-plus/lib/locale/lang/zh-cn'
createApp(App)
.use(store)
.use(router)
.use(ElementPlus, { locale })
.mount('#app')
其中locale 可加可不加,Element UI的默认语言是英文,引入locale 可修改为中文。