https://www.youbaobao.xyz/admin-docs/guide/base/element.html
- 安装 babel-plugin-component
npm install babel-plugin-component -D
- 修改 babel.config.js:
{
"presets": [["es2015", { "modules": false }]],
"plugins": [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
}
- 按需引入 Button 和 Message
import { Button, Message } from 'element-ui'
Vue.component(Button.name, Button)
Vue.prototype.$message = Message