解決方案就是將文字設置為 base64 編碼
字體轉base64編碼網址:https://transfonter.org/
具體步驟如下:
打開剛剛我們經過轉換的解壓出來的文件,找到stylesheet.css,復制 里面內容
@font-face { font-family: 'my-icon'; src: url(data:font/truetype;charset=utf-8;base64,xxxx...) format('truetype'); font-weight: normal; font-style: normal; }
替換原來的
@font-face{ font-family:my-icon; src:url(../font/iconfont.eot?v=240); src:url(../font/iconfont.eot?v=240#iefix) format('embedded-opentype'), url(../font/iconfont.svg?v=240#iconfont) format('svg'), url(../font/iconfont.woff?v=240) format('woff'),url(../font/iconfont.ttf?v=240) format('truetype') }
在強制刷新瀏覽器就可以了,注意緩存