Home > OS >  how to add Element UI to Vue 3
how to add Element UI to Vue 3

Time:03-29

I am trying to add Element UI into my Vue3 Project:

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

App.use(ElementUI)
createApp(App).use(store).use(router).mount('#app')

So I am following this documentation https://element.eleme.io/#/en-US/component/quickstart but it gives me this error: types.js?a742:39 Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')

I dont know what I am doing wrong in this regard.

CodePudding user response:

You should use element-plus which is compatible with vue 3:

Installation :

  npm install element-plus --save

Usage :

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')

  • Related