vue3.2.13引入elementui
全局引入
npm安装
npm i element-plus -S
在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')
按需引入
自动导入
npm安装
npm install -D unplugin-vue-components unplugin-auto-import
在main.js中引入
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
"plugins": [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
}