提交 a5acf8c5 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(css): font-family

上级 31412dd1
<template> <template>
<view style="flex-grow: 1;"> <view>
<view style="height: 500rpx;background-color: gray;justify-content: center;align-items: center;"> <text class="common" style="font-family: monospace"
<text class="common" style="font-family: monospace;">font-family: monospace</text> >font-family: monospace</text
<text class="common" style="font-family: cursive;">font-family: cursive</text> >
<text class="common" style="font-family: AlimamaDaoLiTi;">font-family: 阿里妈妈刀隶体(网络字体下载后生效)</text> <text class="common" style="font-family: cursive"
</view> >font-family: cursive</text
</view> >
</template> <text class="common" style="font-family: AlimamaDaoLiTiTTF"
>font-family: 阿里妈妈刀隶体-ttf(网络字体下载后生效)</text
<script> >
export default { <!-- <text class="common" style="font-family: AlimamaDaoLiTiOTF"
onLoad() { >font-family: 阿里妈妈刀隶体-otf</text
// 加载网络字体 >
uni.loadFontFace({ <text class="common" style="font-family: AlimamaDaoLiTiWOFF"
global: false, >font-family: 阿里妈妈刀隶体-woff</text
source: "https://native-res.dcloud.net.cn/uni-app-x/static/font/AlimamaDaoLiTi.ttf", >
family: "AlimamaDaoLiTi", <text class="common" style="font-family: AlimamaDaoLiTiWOFF2"
success(res) { >font-family: 阿里妈妈刀隶体-woff2</text
console.log(JSON.stringify(res)); > -->
}, </view>
fail(err) { </template>
console.error(JSON.stringify(err));
} <style>
}); .common {
} font-size: 20px;
} line-height: 40px;
</script> }
<style> @font-face {
.common { font-family: AlimamaDaoLiTiTTF;
font-size: 20px; src: url('https://native-res.dcloud.net.cn/uni-app-x/static/font/AlimamaDaoLiTi.ttf');
line-height: 40px; }
} /* @font-face {
</style> font-family: AlimamaDaoLiTiOTF;
\ No newline at end of file src: url('/static/font/AlimamaDaoLiTi.otf');
}
@font-face {
font-family: AlimamaDaoLiTiWOFF;
src: url('/static/font/AlimamaDaoLiTi.woff');
}
@font-face {
font-family: AlimamaDaoLiTiWOFF2;
src: url('/static/font/AlimamaDaoLiTi.woff2');
} */
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册