font-family.uvue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view class="uni-padding-wrap">
  3. <text class="common" style="font-family: monospace">font-family: monospace</text>
  4. <text class="common" style="font-family: cursive">font-family: cursive</text>
  5. <text class="common" style="font-family: AlimamaDaoLiTiTTF">font-family: 阿里妈妈刀隶体-ttf(网络字体下载后生效)</text>
  6. <text class="common" style="font-family: AlimamaDaoLiTiOTF">font-family: 阿里妈妈刀隶体-otf</text>
  7. <text class="common" style="font-family: AlimamaDaoLiTiOTF;font-weight: bold;font-style: italic;">font-family: 阿里妈妈刀隶体-otf(粗斜体)</text>
  8. <text style="font-family: UniFontFamily;">style 加载非 static 目录字体文件:{{uniIcon}}</text>
  9. <!-- <text class="common" style="font-family: AlimamaDaoLiTiWOFF">font-family: 阿里妈妈刀隶体-woff</text>
  10. <text class="common" style="font-family: AlimamaDaoLiTiWOFF2">font-family: 阿里妈妈刀隶体-woff2</text> -->
  11. </view>
  12. <!-- #ifdef APP -->
  13. <view style="margin: 24px 12px;">
  14. <button type="default" @click="openUniIcon">内置字体图标uni-icon示例</button>
  15. </view>
  16. <!-- #endif -->
  17. </template>
  18. <script lang="uts">
  19. export default {
  20. data() {
  21. return {
  22. uniIcon: '\ue100',
  23. }
  24. },
  25. methods: {
  26. openUniIcon() {
  27. uni.navigateTo({
  28. url: '/pages/CSS/text/font-family-icon'
  29. })
  30. }
  31. }
  32. }
  33. </script>
  34. <style>
  35. .common {
  36. font-size: 20px;
  37. line-height: 40px;
  38. }
  39. @font-face {
  40. font-family: AlimamaDaoLiTiTTF;
  41. src: url('https://qiniu-web-assets.dcloud.net.cn/uni-app-x/static/font/AlimamaDaoLiTi.ttf');
  42. }
  43. @font-face {
  44. font-family: AlimamaDaoLiTiOTF;
  45. src: url('/static/font/AlimamaDaoLiTi.otf');
  46. }
  47. @font-face {
  48. font-family: UniFontFamily;
  49. src: url('./uni.ttf');
  50. }
  51. /* @font-face {
  52. font-family: AlimamaDaoLiTiWOFF;
  53. src: url('/static/font/AlimamaDaoLiTi.woff');
  54. }
  55. @font-face {
  56. font-family: AlimamaDaoLiTiWOFF2;
  57. src: url('/static/font/AlimamaDaoLiTi.woff2');
  58. } */
  59. </style>