vue启动报错:Uncaught TypeError: Cannot read properties of undefined (reading ‘use‘)
vue启动报错:Uncaught TypeError: Cannot read properties of undefined (reading 'use')
·
vue项目启动后报如下错误:
![](https://i-blog.csdnimg.cn/blog_migrate/e9430de1bd3bcffa9b936410e04c81c9.png)
猜测element-ui版本不匹配,查看package.json文档发现,自己用的是vue3,但却用了个element-ui,上网查证后发现vue3要用element-plus。下载安装后,修改原来的main.js配置:
![](https://i-blog.csdnimg.cn/blog_migrate/cdf29e6a0f7806affbeddb4a1a581ef2.png)
改为如下:
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/theme-chalk/index.css'
const app = createApp(App)
app.use(ElementPlus)
app.use(router).mount('#app')
可以啦!
![](https://i-blog.csdnimg.cn/blog_migrate/d2633781022f0167f31445fb341bb676.png)
如有不足,欢迎指教!
更多推荐
所有评论(0)