当前位置:网站首页>uniapp uses 3rd party fonts
uniapp uses 3rd party fonts
2022-07-31 01:44:00 【900 million otaku's dream】
One, CSS remote loading
App.vue
@font-face{
font-family: font-name;
src:url('https://XXXXX/font.ttf');
}
in the WeChat appletIt is useful in developer tools, but (Android) real machine debugging is useless
Second, the introduction of local fonts, the program will not upload if the size is too large---the font.ttf file will be converted into base64 format
File conversion address--transfonter


Use
Three, use API uni.loadFontFace()
App.vue
onLaunch: function () {uni.loadFontFace({global: true, // whether to take effect globallyfamily: 'font-name', // Defined font namesource: 'url("https://xxx.com/font/font-name.ttf")', // The address of the font resource.The recommended formats are TTF and WOFF, WOFF2 will be incompatible on lower versions of iOS.success() {console.log('successful callback function')},fail(){console.log('Failed callback function')},complete(){console.log('The callback function at the end of the interface call (the call will be executed if the call succeeds or fails)')}})},
API description: uni.loadFontFace(Object object) | uni-app official website, the development documents of WeChat mini-programs also have corresponding methods. Special attention should be paid to:
Also note that in this discussion wx.loadFontFace loads fonts, Android real machine fails, simulator and ios real machine are normal | WeChat open community , mentioned by the small program technical specialist
Use font website to download-font world
Use.font-name {font-family: font-name;}边栏推荐
猜你喜欢

Dispatch Center xxl-Job

Basic Parameters of RF Devices 1

pycharm重命名后无法运行(报错: can‘t open file......No such file or directory)

Chi-square distribution of digital image steganography

成为比开发硬气的测试人,我都经历了什么?

关于Redis相关内容的基础学习

Xiaohei's leetcode journey: 104. The maximum depth of a binary tree

Set the browser scrollbar style

Google官方控件ShapeableImageView使用

Installation problem corresponding to tensorflow and GPU version
随机推荐
pycharm重命名后无法运行(报错: can‘t open file......No such file or directory)
PDF 拆分/合并
Arbitrum 专访 | L2 Summer, 脱颖而出的 Arbitrum 为开发者带来了什么?
TiKV主要内存结构和OOM排查总结
Google官方控件ShapeableImageView使用
【AcWing 第62场周赛】
tensorflow与GPU版本对应安装问题
华为od 转骰子 js
简易表白小页面
关于Redis相关内容的基础学习
勾股数元组 od js
rpm安装postgresql12
PDF split/merge
加密生活,Web3 项目合伙人的一天
Crawler text data cleaning
MySQL (6)
Word 表格跨页,仍然显示标题
数字图像隐写术之JPEG 隐写分析
1782. 统计点对的数目 双指针
使用PageHelper实现分页查询(详细)