vue3.0 + element-plus自动导入

步骤

1.element-plus安装

npm install element-plus --save

2.官网推荐,自动导入插件

npm install-D unplugin-vue-components unplugin-auto-import

3.配置vue.config.js

项目根目录新建(如无的话)vue.config.js

const AutoImport = require('unplugin-auto-import/webpack')const Components = require('unplugin-vue-components/webpack')const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')module.exports = { configureWebpack: { devServer: { port: 8888, open: true }, plugins: [ AutoImport({ resolvers: [ElementPlusResolver()] }), Components({ resolvers: [ElementPlusResolver()] }) ] }}

4.测试 直接使用,不需要其他配置

```

Default

```

你可能感兴趣的:(vue3.0 + element-plus自动导入)