element按需导入

  1. cnpm i element-ui -D
  2. cnpm install babel-plugin-component -D
  3. main.js
import Vue from 'vue'
import { Button, Select } from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(Button)
Vue.use(Select)

.babelrc

{
  "presets": [
    [
      "env",
      {
        "modules": false
      }
    ]
  ],
  "plugins": [
    [
      "component",
      {
        "libraryName": "element-ui",
        "styleLibraryName": "theme-chalk"
      }
    ]
  ]
}

https://blog.csdn.net/qq_33374198/article/details/79930842

你可能感兴趣的:(element,vue)