uniapp 将svg转换为css可用的图标字体
程序员文章站
2024-02-14 13:43:22
...
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>
上一篇: MFC-控件-树的实现并添加ICO图标