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

发布时间:2022-04-16 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了vue3.0安装Element ui及矢量图使用方式脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
  • 在此只关注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 }

项目中引入矢量图

下载

  • 使用

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

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

脚本宝典总结

以上是脚本宝典为你收集整理的vue3.0安装Element ui及矢量图使用方式全部内容,希望文章能够帮你解决vue3.0安装Element ui及矢量图使用方式所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。