1. 程式人生 > >vue+ydui使用iconfont時圖示不顯示

vue+ydui使用iconfont時圖示不顯示

原本我是這樣定義圖示字型的:(省略woff字型編碼)

@font-face {font-family: YDUI-ICONS;
  src: url('../../fonts/iconfont/iconfont.eot?t=1542201734648');
  src: url('../../fonts/iconfont/iconfont.eot?t=1542201734648#iefix') format('embedded-opentype'),
  url('data:application/x-font-woff;charset=utf-8;base64,...) format('woff'),
  url('../../fonts/iconfont/iconfont.ttf?t=1542201734648') format('truetype'),
  url('../../fonts/iconfont/iconfont.svg?t=1542201734648#iconfont') format('svg');
}

然後專案的圖示一直是小方框,百思不得其解:

 

然後把woff格式的字型去掉,就可以了:

@font-face {font-family: YDUI-ICONS;
  src: url('../../fonts/iconfont/iconfont.eot?t=1542201734648');
  src: url('../../fonts/iconfont/iconfont.eot?t=1542201734648#iefix') format('embedded-opentype'),
  url('../../fonts/iconfont/iconfont.ttf?t=1542201734648') format('truetype'),
  url('../../fonts/iconfont/iconfont.svg?t=1542201734648#iconfont') format('svg')
; }

效果: