Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
f14eb8da
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看板
提交
f14eb8da
编写于
7月 20, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: loadFontFace
上级
ee8ddc31
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
79 addition
and
35 deletion
+79
-35
pages/API/load-font-face/load-font-face-child.uvue
pages/API/load-font-face/load-font-face-child.uvue
+32
-7
pages/API/load-font-face/load-font-face.uvue
pages/API/load-font-face/load-font-face.uvue
+47
-28
未找到文件。
pages/API/load-font-face/load-font-face-child.uvue
浏览文件 @
f14eb8da
...
@@ -2,28 +2,53 @@
...
@@ -2,28 +2,53 @@
<view>
<view>
<page-head title="loadFontFace-child"></page-head>
<page-head title="loadFontFace-child"></page-head>
<view class="uni-padding-wrap">
<view class="uni-padding-wrap">
<text class="item" style="font-family: UniFontFamily"
<text class="font-size-20">上一页全局加载字体:</text>
>全局加载 font-family: uni.ttf</text
<text class="font-size-20 line-height-40" style="font-family: UniFontFamily"
>font-family: uni.ttf</text
>
>
<text class="item" style="font-family: AlimamaDaoLiTiTTF"
<view style="flex-direction: row;">
<text style="font-family: UniFontFamily;font-size:20px;">{{
uniIcon1
}}</text>
<text style="margin-left:5px;margin-right: 20px;line-height:22px;">\ue100</text>
<text style="font-family: UniFontFamily;font-size:20px;">{{
uniIcon2
}}</text>
<text style="margin-left:5px;line-height:22px;">\ue101</text>
</view>
<text class="uni-common-mt font-size-20">上一页非全局加载字体:</text>
<text class="font-size-20 line-height-40" style="font-family: AlimamaDaoLiTiTTF"
>font-family: 阿里妈妈刀隶体-ttf</text
>font-family: 阿里妈妈刀隶体-ttf</text
>
>
<text class="
item
" style="font-family: AlimamaDaoLiTiOTF"
<text class="
font-size-20 line-height-40
" style="font-family: AlimamaDaoLiTiOTF"
>font-family: 阿里妈妈刀隶体-otf</text
>font-family: 阿里妈妈刀隶体-otf</text
>
>
<text class="item" style="font-family: AlimamaDaoLiTiWOFF"
<
!-- <
text class="item" style="font-family: AlimamaDaoLiTiWOFF"
>font-family: 阿里妈妈刀隶体-woff</text
>font-family: 阿里妈妈刀隶体-woff</text
>
>
<text class="item" style="font-family: AlimamaDaoLiTiWOFF2"
<text class="item" style="font-family: AlimamaDaoLiTiWOFF2"
>font-family: 阿里妈妈刀隶体-woff2</text
>font-family: 阿里妈妈刀隶体-woff2</text
>
>
-->
</view>
</view>
</view>
</view>
</template>
</template>
<script>
export default {
data() {
return {
uniIcon1: '\ue100',
uniIcon2: '\ue101',
}
}
}
</script>
<style>
<style>
.
item
{
.
font-size-20
{
font-size: 20px;
font-size: 20px;
}
.line-height-40 {
line-height: 40px;
line-height: 40px;
}
}
</style>
</style>
pages/API/load-font-face/load-font-face.uvue
浏览文件 @
f14eb8da
...
@@ -2,28 +2,45 @@
...
@@ -2,28 +2,45 @@
<view>
<view>
<page-head title="loadFontFace"></page-head>
<page-head title="loadFontFace"></page-head>
<view class="uni-padding-wrap">
<view class="uni-padding-wrap">
<text class="item" style="font-family: UniFontFamily"
<text class="font-size-20">全局加载字体:</text>
>全局加载 font-family: uni.ttf</text
<text class="font-size-20 line-height-40" style="font-family: UniFontFamily"
>font-family: uni.ttf</text
>
>
<text class="item" style="font-family: AlimamaDaoLiTiTTF"
<view style="flex-direction: row;">
<text class="font-size-20" style="font-family: UniFontFamily;">{{
uniIcon1
}}</text>
<text style="margin-left:5px;margin-right: 20px;line-height:22px;">\ue100</text>
<text class="font-size-20" style="font-family: UniFontFamily;">{{
uniIcon2
}}</text>
<text style="margin-left:5px;line-height:22px;">\ue101</text>
</view>
<text class="uni-common-mt font-size-20">非全局加载字体:</text>
<text class="font-size-20 line-height-40" style="font-family: AlimamaDaoLiTiTTF"
>font-family: 阿里妈妈刀隶体-ttf (网络字体下载后生效)</text
>font-family: 阿里妈妈刀隶体-ttf (网络字体下载后生效)</text
>
>
<text class="font-size-20 line-height-40" style="font-family: AlimamaDaoLiTiOTF"
<text class="item" style="font-family: AlimamaDaoLiTiOTF"
>font-family: 阿里妈妈刀隶体-otf</text
>font-family: 阿里妈妈刀隶体-otf</text
>
>
<text class="item" style="font-family: AlimamaDaoLiTiWOFF"
<
!-- <
text class="item" style="font-family: AlimamaDaoLiTiWOFF"
>font-family: 阿里妈妈刀隶体-woff</text
>font-family: 阿里妈妈刀隶体-woff</text
>
>
<text class="item" style="font-family: AlimamaDaoLiTiWOFF2"
<text class="item" style="font-family: AlimamaDaoLiTiWOFF2"
>font-family: 阿里妈妈刀隶体-woff2</text
>font-family: 阿里妈妈刀隶体-woff2</text
>
>
-->
<button class="uni-btn" @click="navigateToChild">跳转子页面</button>
<button class="uni-btn" @click="navigateToChild">跳转子页面</button>
</view>
</view>
</view>
</view>
</template>
</template>
<script>
<script>
export default {
export default {
data() {
return {
uniIcon1: '\ue100',
uniIcon2: '\ue101',
}
},
onLoad() {
onLoad() {
uni.loadFontFace({
uni.loadFontFace({
global: true,
global: true,
...
@@ -57,26 +74,26 @@ export default {
...
@@ -57,26 +74,26 @@ export default {
console.warn('loadFontFace AlimamaDaoLiTi.otf fail', error.errMsg)
console.warn('loadFontFace AlimamaDaoLiTi.otf fail', error.errMsg)
},
},
})
})
uni.loadFontFace({
//
uni.loadFontFace({
family: 'AlimamaDaoLiTiWOFF',
//
family: 'AlimamaDaoLiTiWOFF',
source: '/static/font/AlimamaDaoLiTi.woff',
//
source: '/static/font/AlimamaDaoLiTi.woff',
success() {
//
success() {
console.log('loadFontFace AlimamaDaoLiTi.woff success')
//
console.log('loadFontFace AlimamaDaoLiTi.woff success')
},
//
},
fail(error) {
//
fail(error) {
console.warn('loadFontFace AlimamaDaoLiTi.woff fail', error.errMsg)
//
console.warn('loadFontFace AlimamaDaoLiTi.woff fail', error.errMsg)
},
//
},
})
//
})
uni.loadFontFace({
//
uni.loadFontFace({
family: 'AlimamaDaoLiTiWOFF2',
//
family: 'AlimamaDaoLiTiWOFF2',
source: '/static/font/AlimamaDaoLiTi.woff2',
//
source: '/static/font/AlimamaDaoLiTi.woff2',
success() {
//
success() {
console.log('loadFontFace AlimamaDaoLiTi.woff2 success')
//
console.log('loadFontFace AlimamaDaoLiTi.woff2 success')
},
//
},
fail(error) {
//
fail(error) {
console.warn('loadFontFace AlimamaDaoLiTi.woff2 fail', error.errMsg)
//
console.warn('loadFontFace AlimamaDaoLiTi.woff2 fail', error.errMsg)
},
//
},
})
//
})
},
},
methods: {
methods: {
navigateToChild() {
navigateToChild() {
...
@@ -89,8 +106,10 @@ export default {
...
@@ -89,8 +106,10 @@ export default {
</script>
</script>
<style>
<style>
.
item
{
.
font-size-20
{
font-size: 20px;
font-size: 20px;
}
.line-height-40 {
line-height: 40px;
line-height: 40px;
}
}
</style>
</style>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录