app.js:269 Uncaught TypeError: Cannot read property 'prototype' of undefined
at eval (types.js?8ad0:39)
at Object../node_modules/element-ui/lib/utils/types.js (chunk-vendors.js:889)
at __webpack_require__ (app.js:266)
at fn (app.js:522)
at eval (util.js?40a4:19)
at Object../node_modules/element-ui/lib/utils/util.js (chunk-vendors.js:900)
at __webpack_require__ (app.js:266)
at fn (app.js:522)
at eval (format.js?5a92:49)
at Object../node_modules/element-ui/lib/locale/format.js (chunk-vendors.js:556)
原因:
vue2没有这个问题,按照elementui官方导入方式:vue3和elementui不兼容。
解决办法:
①安装
npm install element-plus --save
②在main.js中引入
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
const app = createApp(App)
app.use(ElementPlus)
app.mount('#app')