vue/cli@4|vue/cli@4 ,引入element-ui 的步骤及踩坑记录-按需引入

1.main.js中这样写 ,其他组件用啥,main中引入啥 import {Message,Button} from 'element-ui'
Vue.use(Message)
Vue.use(Button)
Vue.prototype.$message = Message;
Message.closeAll()
2.没下的依赖,下载一下 "babel-loader": "^8.0.6",
"babel-plugin-component": "^1.1.1",
"cache-loader": "^4.1.0",
"core-js": "^3.6.3",
"element-ui": "^2.13.0",
"vue-loader": "^15.8.3"
"vue-cli-plugin-element": "^1.0.1",
3.babel.config.js 中配置修改一下 module.exports = {
presets: [
【vue/cli@4|vue/cli@4 ,引入element-ui 的步骤及踩坑记录-按需引入】'@vue/cli-plugin-babel/preset'
],
"plugins": [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
}
4.组件中应用 ,就完全可以启动了

    推荐阅读