1、安装 babel-plugin-component:
npm install babel-plugin-component -D
2、babel.config.js文件中,在plugins中添加如下:
"plugins": [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
3、在main.js中,需要用到什么组件就import什么组件
import { Image } from 'element-ui'
Vue.use(Image)
4、上面引入之后在.vue中就能使用了
<el-image></el-image>