@vue/cli element plus 自动导入

  • 首先你需要安装unplugin-vue-componentsunplugin-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()],
          }),
        ],
    },
}

 

上一篇:AugFPN 环境配置


下一篇:C/C++const修饰彻底搞懂