vue中使用element(菜鸟教程)

前言:

      在我们的vue项目中可供引入的框架是很多的,这里分享下在vue中使用element-ui的框架

element-ui官网入口

实现步骤:

一、引入element-ui

   方法1:安装node

cnpm i element-ui --save

  方法2:cdn引入

<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>

二、main.js中注册(如果上面使用的是cdn引入则没有这一步)

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

三、到这一步element-ui应该配置的文件我们都引入成功了,下来该使用了

1、打开官网地址,参照下面的4个小步骤可以拿到想要的效果和代码

2、实际练习,以 el-button 按钮作案例,找到Button,然后找到基础用法,点击粉色圈,打开源代码

3、拿到源代码以后在页面上试一试

a.vue(案例文件)中引入 elementbutton

<template>
  <div>


    内容区域

   <el-button type="danger" plain>危险按钮</el-button>




  </div>
</template>

4、到这一步,就可以到页面上看你写的效果了,教程到此结束了!

 

 

Vue + Element是一种在Vue项目中使用Element UI框架的组合。Element是一个基于Vue 2.0的桌面端组件库,为开发者、设计师和产品经理提供了丰富的组件和样式。\[1\] 要在Vue项目中使用Element UI,首先需要引入Element UI。可以通过两种方法引入:一种是通过安装Node包,另一种是通过CDN引入。如果选择安装Node包的方式,可以使用命令`cnpm i element-ui --save`进行安装。如果选择CDN引入的方式,需要在HTML文件中引入Element UI的样式和组件库的链接。\[3\] 在main.js文件中,需要注册Element UI。可以通过`import ElementUI from 'element-ui'`和`Vue.use(ElementUI)`来注册Element UI。这样就可以在Vue项目中使用Element UI的组件了。\[2\]\[3\] 使用Element UI的具体步骤可以参考Element官网提供的例子和代码,根据官网的指引来实现想要的效果。\[3\] 总结起来,Vue + Element是指在Vue项目中使用Element UI框架的组合。通过引入Element UI并在main.js中注册,可以在Vue项目中使用Element UI的丰富组件和样式。具体的使用步骤可以参考Element官网提供的例子和代码。 #### 引用[.reference_title] - *1* *2* [VueElement使用](https://blog.csdn.net/s_9527_s/article/details/123094193)[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^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [vue使用element(菜鸟教程)](https://blog.csdn.net/weixin_44727080/article/details/113607189)[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^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 23
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值