Vue学习笔记-问题4 - Uncaught TypeError: Cannot read properties of undefined (reading ‘prototype‘) 错误

在尝试使用Vue3.x版本时,遇到了与element-ui的兼容性问题,报出`UncaughtTypeError`,因为element-ui仅支持Vue2.x。解决方案是切换到支持Vue3.x及更高版本的element-plus。
摘要由CSDN通过智能技术生成

说起来挺坑的,Vue 2.x 和 3.x 好多地方不兼容。

而网上好多教程,视频都是以 Vue2.x 为基准做的。

然后就悲催的发现各种不调。

比如标题的这个错误:

Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
    at eval (types.js:39:1)
    at ./node_modules/element-ui/lib/utils/types.js (chunk-vendors.js:202:1)
    at __webpack_require__ (app.js:358:33)
    at fn (app.js:591:21)
    at eval (util.js:19:1)
    at ./node_modules/element-ui/lib/utils/util.js (chunk-vendors.js:213:1)
    at __webpack_require__ (app.js:358:33)
    at fn (app.js:591:21)
    at eval (migrating.js:5:1)
    at ./node_modules/element-ui/lib/mixins/migrating.js (chunk-vendors.js:169:1)

就是写下面这个代码的时候出的错误:

其实呢,我试了前两个,是没错的,我怎么也没理解element-ui怎么会没有 Input组件:)

import { createApp } from 'vue'
import App from '../App.vue'
import { Button, Form, Input } from 'element-ui'

createApp(App).use(Button, Form, Input)

错误的原因是 element-ui 只支持 Vue2.x,而想用Vue3.x及以上,比如Vue5.x,那就要用element-plus。

>You’re browsing the documentation of Element UI for Vue 2.x version. Click here for Vue 3.x version

 

<参考>

1,黑马程序员 Vue 前端开发

16.登录组件表单布局__哔哩哔哩_bilibili

2,问题:用vue-cli3.x创建项目 引入element时无法显示组件

https://www.cnblogs.com/lingern/p/15892856.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值