font-icon.uvue 2.7 KB
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
<template>
  <!-- #ifdef APP -->
  <scroll-view style="flex: 1;">
  <!-- #endif -->
<view style="align-items: center;align-self: center;">
  <view class="iconContainer">
    <view class="iconItem" v-for="item in uniIcons">
      <text class="icon">{{String.fromCharCode(parseInt(item.code,16))}}</text>
      <text class="code">\u{{item.code}}</text>
      <text class="name">{{item.name}}</text>
    </view>
  </view>
</view>
  <!-- #ifdef APP -->
  </scroll-view>
  <!-- #endif -->
</template>

<script lang="uts">
  type Icon = {
    name : string,
    code : string,
  }

  export default {
    data() {
      return {
        uniIcons: [ //图标数据
          {
            'name':'forward',
            'code':'E600',
          },
          {
            'name':'back',
            'code':'E601',
          },
          {
            'name':'share',
            'code':'E602',
          },
          {
            'name':'favorites',
            'code':'E604',
          },
          {
            'name':'home',
            'code':'E605',
          },
          {
            'name':'more',
            'code':'E606',
          },
          {
            'name':'close',
            'code':'E650',
          },
          {
            'name':'down',
            'code':'E661',
          },
          {
            'name':'circle',
            'code':'EA01',
          },
          {
            'name':'info',
            'code':'EA03',
          },
          {
            'name':'info circle',
            'code':'EA04',
          },
          {
            'name':'success',
            'code':'EA06',
          },
          {
            'name':'success circle',
            'code':'EA07',
          },
          {
            'name':'success no circle',
            'code':'EA08',
          },
          {
            'name':'cancel circle',
            'code':'EA0B',
          },
          {
            'name':'warn',
            'code':'EA0F',
          },
          {
            'name':'clear',
            'code':'EA14',
          },
          {
            'name':'download',
            'code':'EA19',
          },
          {
            'name':'waitnig',
            'code':'EA1E',
          },
          {
            'name':'search',
            'code':'EA23',
          }
        ] as Icon[],
      }
    }
  }
</script>

<style>
.iconContainer {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
}
.iconItem {
  width: 100px;
  height: 150px;
  justify-content: center;
  align-items: center;
}
.icon {
  width: 48px;
  height: 48px;
  font-family: uni-icon;
  font-size: 42px;
  line-height: 48px;
  color: #333;
  margin-bottom: 8px;
}
.code {
  font-size: 14px;
  color: #f00;
}
.name {
  font-size: 12px;
  color: #000;
}
</style>