elementUI的使用



element UI的使用:


  1. 官网  http://element.eleme.io/#/zh-CN/component/quickstart
  2. 安装  cnpm i element-ui -S         -S表示  --save
  3.   引入element UI的css 和 插件,放入main.js文件中
              import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

        4.    webpack.config.js  配置file_loader    

  {
test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/,
loader: 'file-loader'

          }

如果不添加以上代码,运行时会报如下错误:

ERROR in ./node_modules/_element-ui@2.3.9@element-ui/lib/theme-chalk/fonts/element-icons.woff
Module parse failed: Unexpected character ' ' (1:4)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
 @ ./node_modules/_css-loader@0.28.11@css-loader!./node_modules/_element-ui@2.3.9@element-ui/lib/theme-chalk/index.css 7:335-372
 @ ./node_modules/_element-ui@2.3.9@element-ui/lib/theme-chalk/index.css
 @ ./src/main.js
 @ multi ./node_modules/_webpack-dev-server@2.11.2@webpack-dev-server/client?http://localhost:8082 webpack/hot/dev-server ./src/main.js

5.需要什么组件看文档,按文档操作就可以了




  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ElementUI是一个基于Vue.js的组件库,可以帮助开发者快速构建用户界面。在使用ElementUI之前,需要先导入ElementUI的组件库和相关样式。可以通过在入口文件(main.js)中导入ElementUI并配置Vue插件来实现。具体的步骤如下: 1. 在入口文件(main.js)中导入ElementUI组件库和相关样式: ``` // 导入组件库 import ElementUI from 'element-ui' // 导入组件相关样式 import 'element-ui/lib/theme-chalk/index.css' ``` 2. 配置Vue插件,将ElementUI安装到Vue上: ``` // 配置Vue插件 Vue.use(ElementUI); ``` 3. 在需要使用ElementUI组件的地方,按需导入所需的组件并注册为Vue的组件。例如,如果要使用Button组件,可以在组件文件中按需导入Button组件并注册为Vue的组件: ``` // 导入Button组件 import { Button } from 'element-ui' // 注册Button组件 export default { components: { 'el-button': Button } } ``` 通过以上步骤,就可以在Vue项目中使用ElementUI组件了。请注意,如果在使用过程中遇到报错,可以检查是否有其他配置文件或插件冲突,例如.eslintrc.js文件中的配置或者.prettierrc文件中的格式化规则。 #### 引用[.reference_title] - *1* [饿了么神级UI组件库——Element-UI使用指南](https://blog.csdn.net/m0_67402235/article/details/123399370)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [Element-ui使用](https://blog.csdn.net/weixin_45525630/article/details/119383414)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值