uniapp 将svg转换为css可用的图标字体

1.转换平台链接 https://icomoon.io

2.转换步骤

2.1 打开https://icomoon.io/ 后,点击右上角登录旁边的icoMoon App进行登录
2.2 具体流程图
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2.3 代码配置
.将style.css和fonts文件放到项目的静态资源文件下并全局设置引入

引用方式

<i style="font-size: 48upx;position: absolute;left: 20rpx;color: #fff;" class="melyshop-melyshop-uniE905"></i>

也可以自己进行全局配置

<script>
	import Vue from 'vue'
	import config from 'common/js/config.js';
	export default {
		onLaunch: function() {
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	@font-face {
	  font-family: 'icomoon';
	  src:  url('fonts/icomoon.eot?wnsqld');
	  src:  url('fonts/icomoon.eot?wnsqld#iefix') format('embedded-opentype'),
	    url('fonts/icomoon.ttf?wnsqld') format('truetype'),
	    url('fonts/icomoon.woff?wnsqld') format('woff'),
	    url('fonts/icomoon.svg?wnsqld#icomoon') format('svg');
	  font-weight: normal;
	  font-style: normal;
	  font-display: block;
	}
	
	[class^="icon-"], [class*=" icon-"] {
	  /* use !important to prevent issues with browser extensions that change fonts */
	  font-family: 'icomoon' !important;
	  speak: never;
	  font-style: normal;
	  font-weight: normal;
	  font-variant: normal;
	  text-transform: none;
	  line-height: 1;
	
	  /* Better Font Rendering =========== */
	  -webkit-font-smoothing: antialiased;
	  -moz-osx-font-smoothing: grayscale;
	}
	
	.icon-home_customer:before {
	  content: "\e906";
	  color: #fc3c5c;
	}
	.icon-home_bind:before {
	  content: "\e901";
	}
	.icon-home_order:before {
	  content: "\e902";
	}
	.icon-home_upgrade:before {
	  content: "\e903";
	}
	.icon-home_mine:before {
	  content: "\e904";
	  color: #fc3c5c;
	}
	.icon-home_ask:before {
	  content: "\e905";
	  color: #fc3c5c;
	}
	.icon-home_icon:before {
	  content: "\e900";
	  color: #fc3c5c;
	}

</style>

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值