引用Element组件

1、按需引入:

npm输入命令:

npm install babel-plugin-component -D

yarn输入命令

yarn add install babel-plugin-component -D

然后,将 .babelrc 修改为:

 [
      "component",
      {
        "libraryName": "element-ui",
        "styleLibraryName": "theme-chalk"
      }
 ]

在这里插入图片描述
在mian.js中引入:

import { <DatePicker, Select, Option >用的组件名称} from 'element-ui'
Vue.use(<DatePicker, Select, Option> 用的组件名称)

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_41627870/article/details/88356852
今日推荐