iconfont在ionic中的使用:
1.進入iconfont官方網址後
2.搜索你想要的圖標,添加到購物車(前提:是已經登錄,這裏可以使用github註冊登錄)
3.點擊購物車創建項目並下載到本地
4.下載之後的文件
5,在index.html引入
-
<!-- 引入iconfont的css -->
-
<link rel="stylesheet" href="assets/font/iconfont.css">
6.在頁面這樣顯示<i class="iconfont icon-music"></i>(icon-music是圖標的名稱)
在iconfont.css裏面查看(也可以在這個文件裏設置想要的顏色,設置大小)
-
<ion-grid>
-
<!-- wrap:用來換行 -->
-
<ion-row wrap>
-
<ion-col text-center tappable col-3 *ngFor="let music of musicCate" >
-
<i class="iconfont {{music.icon}}"></i><br>
-
<span class="title">{{music.name}}</span>
-
</ion-col>
-
</ion-row>
-
</ion-grid>
這裏是我項目中取出圖片的方式,
頁面展示: