首先安装Element-plus
npm install element-plus
1、第一种方式,使用全局引入
引入element-plus的方式是全局引入,代表的含义是所有的组件和插件都会被自动注册,
优点:上手快
缺点:会增大包的体积
在main.ts文件中
import { createApp } from 'vue'
import App from './App.vue'
// 全局引入引入element
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
const app = createApp(App)
app.use(ElementPlus)
app.mount('#app')