vue3.0安装Element ui及矢量图使用方式

2022-04-15 0 1,170
  • 在此只关注v3的安装及使用,如果想了解v2可移步到其官网:https://element.eleme.io/#/zh-CN/component/installation
  • v3官网:https://element-plus.org/zh-CN/guide/installation.html
  • 使用element ui时vue2和vue3的区别
  • 安装命令

main.js中引入文件有所不同 使用icon时v2不需要安装,v3需安装 v2和v3在vue文件中使用icon时编写方式有所不同

icon在v2中使用的是字体,v3中使用的是svg

安装Element ui

  • 使用npm安装

npm install element-plus –save

icon图标需安装

npm install @element-plus/icons-vue

  • 使用

在main.js中全局转入

import elementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import '@/assets/css/index.scss'
//引入外部矢量图
import '@/assets/iconfont/iconfont.css'
const app = createApp(App);
app.config.globalProperties.axios = axios;
app
.use(elementPlus)
.mount('#app');

按照Element ui中规定标签的写法,正常编写代码

vue文件使用icon图标

<el-icon :size="size" :color="color"> <edit></edit> </el-icon>
或
<edit></edit>
<add-location/>
//矢量图
<i class="iconfont icon-huyan"></i>
//引入需要使用的icon(svg)
import {Edit,AddLocation} from '@element-plus/icons-vue'
components:{ Edit, AddLocation }

项目中引入矢量图

下载

vue3.0安装Element ui及矢量图使用方式

vue3.0安装Element ui及矢量图使用方式

  • 使用

将这六个文件拷贝到项目中,在main.js中引入后再进行使用

vue3.0安装Element ui及矢量图使用方式

到此这篇关于vue3.0安装Element ui及矢量图使用的文章就介绍到这了,更多相关vue3.0安装Element ui内容请搜索NICE源码以前的文章或继续浏览下面的相关文章希望大家以后多多支持NICE源码!

免责声明:
1、本网站所有发布的源码、软件和资料均为收集各大资源网站整理而来;仅限用于学习和研究目的,您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。 不得使用于非法商业用途,不得违反国家法律。否则后果自负!

2、本站信息来自网络,版权争议与本站无关。一切关于该资源商业行为与www.niceym.com无关。
如果您喜欢该程序,请支持正版源码、软件,购买注册,得到更好的正版服务。
如有侵犯你版权的,请邮件与我们联系处理(邮箱:skknet@qq.com),本站将立即改正。

NICE源码网 JavaScript vue3.0安装Element ui及矢量图使用方式 https://www.niceym.com/21817.html