当前位置:网站首页>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;}
边栏推荐
猜你喜欢
观察者(observer)模式(一)
成为比开发硬气的测试人,我都经历了什么?
MySql installation and configuration super detailed tutorial and simple method of building database and table
TiDB 在多点数字化零售场景下的应用
基于Keras_bert模型的Bert使用与字词预测
Chi-square distribution of digital image steganography
JS逆向之浏览器补环境(一)
解析云原生消息流系统 Apache Pulsar 能力及场景
CV-Model【3】:MobileNet v2
The sword refers to offer17---print the n digits from 1 to the largest
随机推荐
力扣每日一题-第46天-704. 二分查找
Basic Parameters of RF Devices 1
tkinter模块高级操作(二)—— 界面切换效果、立体阴影字效果及gif动图的实现
Gateway路由的配置方式
【flask入门系列】Flask-SQLAlchemy的使用
822. Walk the Grid
PDF split/merge
《实战》基于电商领域的词性提取及其决策树模型建模
pycharm重命名后无法运行(报错: can‘t open file......No such file or directory)
Simple confession page
MySQL installation tutorial (detailed, package teaching package~)
验证 XML 文档
蓝牙mesh系统开发二 mesh节点开发
934. 最短的桥
华为od 转骰子 js
1782. 统计点对的数目 双指针
"Actual Combat" based on part-of-speech extraction in the field of e-commerce and its decision tree model modeling
Parameter introduction and selection points of wireless module
Installation problem corresponding to tensorflow and GPU version
TiCDC 架构和数据同步链路解析