【报错】:Cannot read properties of undefined (reading ‘prototype‘)

简介: 【报错】:Cannot read properties of undefined (reading ‘prototype‘)

@[toc]

报错问题

vue3.x创建项目 引用 elementUI 控制台报错 如下图所示:

在这里插入图片描述

报错分析

element官网说
在这里插入图片描述

实例对象不一致,官网上的实例对象是vue/3.0(vue2.x)版本创建的对象,而我创建的项目是用 vue3.x 创建的,实例对象是createdApp 实例对象不一致,当然也就引不进去,继而报错了

报错解决

vue2.x

创建项目的时候选用vue2.x创建项目,其他操作照常。( element是支持 vue2.x 的,vue3.x 暂时还不支持 ElementUI
在这里插入图片描述

vue3.x

使用vue3.x版本 引入ElementUI
你要是想用vue3.x 引入element 也不是不可以的,他推出的支持vue3.0的版本叫 element-plus 点这里进入

安装:

npm install element-plus --save

使用:在main.js 写入以下内容

import {
   
    createApp } from 'vue'
import ElementPlus from 'element-plus';
import 'element-plus/lib/theme-chalk/index.css';
import App from './App.vue';

const app = createApp(App)
app.use(ElementPlus)
app.mount('#app')
相关文章
Cannot read properties of undefined (reading ‘resetFields‘)“
Cannot read properties of undefined (reading ‘resetFields‘)“
309 0
|
4月前
|
存储 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‘)
Cannot read properties of undefined (reading ‘post‘)
Cannot read properties of undefined (reading ‘post‘)
|
5月前
|
JavaScript 前端开发
报错:Cannot read properties of undefined (reading ‘$message‘)解决方法
以上就是解决"Cannot read properties of undefined (reading ‘$message‘)"错误的几种方法,希望对你有所帮助。
3194 0
|
5月前
|
JavaScript
Cannot read properties of undefined (reading ‘$router‘)
Cannot read properties of undefined (reading ‘$router‘)
Cannot read properties of undefined (reading ‘row‘)
Cannot read properties of undefined (reading ‘row‘)
Cannot read properties of undefined (reading ‘use‘)-------编程版本问题
Cannot read properties of undefined (reading ‘use‘)-------编程版本问题
|
7月前
|
JavaScript
报错 Cannot read properties of undefined(reading‘addEventListener‘)如何解决
报错 Cannot read properties of undefined(reading‘addEventListener‘)如何解决
345 1
|
7月前
报错:cannot read properties of undefined(reading ‘forEach‘)
报错:cannot read properties of undefined(reading ‘forEach‘)
627 1
报错:cannot read properties of undefined(reading ‘forEach‘)
|
7月前
【报错】 “TypeError: Cannot read properties of undefined (reading ‘split‘)“
【报错】 “TypeError: Cannot read properties of undefined (reading ‘split‘)“
938 0