Vue3引入element-ui报错:Uncaught TypeError: Cannot read property ‘prototype‘ of undefined

简介: 配置无误、代码未报错,运行时页面空白,F12控制台报错:Uncaught TypeError: Cannot read property ‘prototype’ of undefined

为什么

你写的引入方式可能是这种

import ElementUI from "element-ui";
import "element-plus/lib/theme-chalk/index.css";
Vue.use(ElementUI)

配置无误、代码未报错,运行时页面空白,F12控制台报错:

Uncaught TypeError: Cannot read property ‘prototype’ of undefined

解决办法

原因就是在main.js引入element-ui方式错误(vue3.0的坑)


先下载

npm install element-plus --save

vue3中正确引入方式如下

import ElementUI from "element-plus";
import "element-plus/dist/index.css"
createApp(App).use(store).use(router).use(ElementUI).mount('#app')

一定要注意哦!!! vue3是element-plus,然后重新启动,解决!

相关文章
|
3月前
|
JavaScript
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
70 0
|
3月前
|
前端开发 JavaScript
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
51 0
|
4月前
|
定位技术
vue-baidu-map 报错 | map is undefined
vue-baidu-map 报错 | map is undefined
77 1
|
4月前
|
JavaScript
vue项目中升级element ui(含常见报错及解决方案,如表格不显示,el-table无效, “__v_isRef“ is not defined,Use :deep() instead)
vue项目中升级element ui(含常见报错及解决方案,如表格不显示,el-table无效, “__v_isRef“ is not defined,Use :deep() instead)
55 0
|
4月前
|
JavaScript 前端开发
报错:Cannot read properties of undefined (reading ‘$message‘)解决方法
以上就是解决"Cannot read properties of undefined (reading ‘$message‘)"错误的几种方法,希望对你有所帮助。
2774 0
|
5月前
|
前端开发 小程序 JavaScript
微信小程序-Unhandled promise rejection TypeError: Cannot read property ‘get‘ of undefined
微信小程序-Unhandled promise rejection TypeError: Cannot read property ‘get‘ of undefined
|
3月前
|
存储 JavaScript 前端开发
成功解决:Cannot read properties of undefined (reading ‘commit‘)
这篇文章提供了解决Vuex中"Cannot read properties of undefined (reading 'commit')"错误的两种方法:检查模板中的数据属性是否存在,以及确保在Vue实例中正确挂载了store对象。
成功解决:Cannot read properties of undefined (reading ‘commit‘)
|
3月前
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
77 0
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
Cannot read properties of undefined (reading ‘row‘)
Cannot read properties of undefined (reading ‘row‘)