vue打包后整合到springboot, elementui字體圖標顯示為框框問題


在build/utils.js下找到

if (options.extract) {
   return ExtractTextPlugin.extract({
     use: loaders,
     fallback: 'vue-style-loader',
     publicPath: '../../'
   })
 } else {
   return ['vue-style-loader'].concat(loaders)
 }

加上

publicPath: '../../'       

運行項目還是不行 ,Failed to decode downloaded font: http://192.168.11.110:8081/dist/static/font  路徑也是對的

網上搜了很多,大部分說是后台經過maven的filter,會破壞font文件的二進制文件格式,導致前台解析出錯

但是我的是運行在本地環境下,還沒有進行打包部署

解決方式:

在maven文件的pom文件的build標簽加入下面的


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>

重啟項目,這樣應該就可以了                                                             


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM