@vue/cli element plus 自动导入
作者:互联网
- 首先你需要安装
unplugin-vue-components
和unplugin-auto-import
这两款插件
npm install -D unplugin-vue-components unplugin-auto-import
- 在vue脚手架所创建项目根目录创建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: { plugins: [ AutoImport({ resolvers: [ElementPlusResolver()], }), Components({ resolvers: [ElementPlusResolver()], }), ], }, }
标签:vue,const,cli,auto,element,unplugin,components,import 来源: https://www.cnblogs.com/bmbrother/p/15900144.html