vue项目引用图标font-awesome提示错误?

vue项目引用图标font-awesome提示错误

Failed to decode downloaded font: http://localhost:3005/fonts/glyphicons-halflings-regular.woff2
login:1 OTS parsing error: invalid version tag
login:1 Failed to decode downloaded font: http://localhost:3005/fonts/glyphicons-halflings-regular.woff
login:1 OTS parsing error: invalid version tag
login:1 Failed to decode downloaded font: http://localhost:3005/fonts/glyphicons-halflings-regular.ttf
login:1 OTS parsing error: invalid version tag

现在的问题是图标没有办法显示,会显示为一个方块,应该怎么改?

阅读 4.7k
3 个回答

添加代码

@font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
       url('webfont.woff') format('woff'), /* Pretty Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

应该是你引用的方式不对 你是通过什么方式引用的呢 你可以选择在线引用
在html 页面 引入 生成的css <link rel="stylesheet" href="//at.alicdn.com/t/font_1180806_k64nbgmu96e.css"> 页面中就可以正常使用的

在main.js 中 import 'font-awesome/css/font-awesome.min.css'

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题