Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
a8cd2875
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a8cd2875
编写于
11月 09, 2024
作者:
DCloud-yinjiacheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新loadFontFace示例
上级
956fac30
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
2 deletion
+20
-2
pages/API/load-font-face/load-font-face.uvue
pages/API/load-font-face/load-font-face.uvue
+20
-2
未找到文件。
pages/API/load-font-face/load-font-face.uvue
浏览文件 @
a8cd2875
...
@@ -13,7 +13,14 @@
...
@@ -13,7 +13,14 @@
}}</text>
}}</text>
<text style="margin-left:5px;line-height:22px;">\ue101</text>
<text style="margin-left:5px;line-height:22px;">\ue101</text>
</view>
</view>
<text class="uni-common-mt font-size-20">非全局加载字体:</text>
<text class="uni-common-mt font-size-20">非全局加载字体:</text>
<text class="font-size-20 line-height-40">font-family: uni.ttf(base64格式)</text>
<view style="flex-direction: row;">
<text class="font-size-20" style="font-family: UniFontFamily2;">{{
uniIcon3
}}</text>
<text style="margin-left:5px;margin-right: 20px;line-height:22px;">\ue102</text>
</view>
<text class="font-size-20 line-height-40" style="font-family: AlimamaDaoLiTiTTF">font-family: 阿里妈妈刀隶体-ttf
<text class="font-size-20 line-height-40" style="font-family: AlimamaDaoLiTiTTF">font-family: 阿里妈妈刀隶体-ttf
(网络字体下载后生效)</text>
(网络字体下载后生效)</text>
<text class="font-size-20 line-height-40" style="font-family: AlimamaDaoLiTiOTF">font-family:
<text class="font-size-20 line-height-40" style="font-family: AlimamaDaoLiTiOTF">font-family:
...
@@ -28,7 +35,8 @@
...
@@ -28,7 +35,8 @@
data() {
data() {
return {
return {
uniIcon1: '\ue100',
uniIcon1: '\ue100',
uniIcon2: '\ue101',
uniIcon2: '\ue101',
uniIcon3: '\ue102'
}
}
},
},
onLoad() {
onLoad() {
...
@@ -42,6 +50,16 @@
...
@@ -42,6 +50,16 @@
fail(error) {
fail(error) {
console.warn('global loadFontFace uni.ttf fail', error.errMsg)
console.warn('global loadFontFace uni.ttf fail', error.errMsg)
},
},
})
uni.loadFontFace({
family: 'UniFontFamily2',
source: "url(data:font/ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMjpAVPQAAACsAAAAYGNtYXAADeKoAAABDAAAAUJnbHlmUL6yUwAAAlAAAAEYaGVhZBeGAMAAAANoAAAANmhoZWED3gOCAAADoAAAACRobXR4BCEAAAAAA8QAAAAGbG9jYQCMAAYAAAPMAAAABm1heHABEQBiAAAD1AAAACBuYW1le6YhIAAAA/QAAAMecG9zdNTj4UYAAAcUAAAAMAAEBAABkAAFAAACiQLMAAAAjwKJAswAAAHrADIBCAAAAgAFAwAAAAAAAAAAAAAQAAAAAAAAAAAAAABQZkVkAEDhAuECA4D/gABcA4AAgAAAAAEAAAAAAgACzQAAAAAAAAAAAAMAAAADAAAAHAABAAAAAAA8AAMAAQAAABwABAAgAAAABAAEAAEAAOEC//8AAOEC//8e/wABAAAAAAAAAQYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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pY29uc1JlZ3VsYXJ1bmlpY29uczpWZXJzaW9uIDEuMDB1bmlpY29uc1ZlcnNpb24gMS4wMDtKYW51YXJ5IDMsIDIwMjA7Rm9udENyZWF0b3IgMTIuMC4wLjI1MzUgNjQtYml0dW5paWNvbnNHZW5lcmF0ZWQgYnkgc3ZnMnR0ZiBmcm9tIEZvbnRlbGxvIHByb2plY3QuaHR0cDovL2ZvbnRlbGxvLmNvbQBDAHIAZQBhAHQAZQBkACAAYgB5ACAAaQBjAG8AbgBmAG8AbgB0AHUAbgBpAGkAYwBvAG4AcwBSAGUAZwB1AGwAYQByAHUAbgBpAGkAYwBvAG4AcwA6AFYAZQByAHMAaQBvAG4AIAAxAC4AMAAwAHUAbgBpAGkAYwBvAG4AcwBWAGUAcgBzAGkAbwBuACAAMQAuADAAMAA7AEoAYQBuAHUAYQByAHkAIAAzACwAIAAyADAAMgAwADsARgBvAG4AdABDAHIAZQBhAHQAbwByACAAMQAyAC4AMAAuADAALgAyADUAMwA1ACAANgA0AC0AYgBpAHQAdQBuAGkAaQBjAG8AbgBzAEcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAAcwB2AGcAMgB0AHQAZgAgAGYAcgBvAG0AIABGAG8AbgB0AGUAbABsAG8AIABwAHIAbwBqAGUAYwB0AC4AaAB0AHQAcAA6AC8ALwBmAG8AbgB0AGUAbABsAG8ALgBjAG8AbQAAAAIAAAAAAAAACgABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAgAAAQIJcGVyc29uYWRk)",
success() {
console.log('loadFontFace uni.ttf(base64 format) success')
},
fail(error) {
console.warn('loadFontFace uni.ttf(base64 format) fail', error.errMsg)
},
})
})
uni.loadFontFace({
uni.loadFontFace({
family: 'AlimamaDaoLiTiTTF',
family: 'AlimamaDaoLiTiTTF',
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录