font-family.uvue 1.6 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1
<template>
DCloud-WZF's avatar
DCloud-WZF 已提交
2
  <view class="uni-padding-wrap">
3 4 5 6
    <text class="common" style="font-family: monospace">font-family: monospace</text>
    <text class="common" style="font-family: cursive">font-family: cursive</text>
    <text class="common" style="font-family: AlimamaDaoLiTiTTF">font-family: 阿里妈妈刀隶体-ttf(网络字体下载后生效)</text>
    <text class="common" style="font-family: AlimamaDaoLiTiOTF">font-family: 阿里妈妈刀隶体-otf</text>
7 8
    <text style="font-family: UniFontFamily;">style 加载非 static 目录字体文件:{{uniIcon}}</text>
    <!--    <text class="common" style="font-family: AlimamaDaoLiTiWOFF">font-family: 阿里妈妈刀隶体-woff</text>
9
    <text class="common" style="font-family: AlimamaDaoLiTiWOFF2">font-family: 阿里妈妈刀隶体-woff2</text> -->
DCloud-WZF's avatar
DCloud-WZF 已提交
10 11 12
  </view>
</template>

13 14 15 16 17 18 19 20 21 22
<script lang="uts">
  export default {
    data() {
      return {
        uniIcon: '\ue100',
      }
    }
  }
</script>

DCloud-WZF's avatar
DCloud-WZF 已提交
23
<style>
24 25 26 27
  .common {
    font-size: 20px;
    line-height: 40px;
  }
28

29 30 31 32
  @font-face {
    font-family: AlimamaDaoLiTiTTF;
    src: url('https://native-res.dcloud.net.cn/uni-app-x/static/font/AlimamaDaoLiTi.ttf');
  }
33

34 35 36 37
  @font-face {
    font-family: AlimamaDaoLiTiOTF;
    src: url('/static/font/AlimamaDaoLiTi.otf');
  }
38 39 40 41 42 43 44

  @font-face {
    font-family: UniFontFamily;
    src: url('./uni.ttf');
  }

  /*  @font-face {
45 46 47 48 49 50 51
    font-family: AlimamaDaoLiTiWOFF;
    src: url('/static/font/AlimamaDaoLiTi.woff');
  }
  @font-face {
    font-family: AlimamaDaoLiTiWOFF2;
    src: url('/static/font/AlimamaDaoLiTi.woff2');
  } */
52
</style>