当前位置: 首页 > 工具软件 > Typebase.css > 使用案例 >

用vue-cli3导入外部的iconfont.css图标样式遇到的坑:These relative modules were not found:...

戴正阳
2023-12-01

错误信息截图:

就是找不到这些字体,从iconfont下载的字体代码 ,会有几个字体文件,你新建个font文件夹在assets 目录里面.

截图如下:

然后要去iconfont.css字体路径 需要改成我们刚刚新建的font文件夹

@font-face {font-family: "iconfont";
  src: url('./font/iconfont.eot?t=1548037533565'); /* IE9 */
  src: url('./font/iconfont.eot?t=1548037533565#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAASEAAsAAAAACRgAAAQ3AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDMgqFOIRpATYCJAMUCwwABCAFhG0HRhvzB8gekiRBEIEf/KAKAshGPPC/X+0+m/3nzZpoEsQynjaTNuFxQoNQaGQilVKhbcNKmCE384AovAsvzosYqYhFDoiSEvLitB66ifqmm3mkPqmvTYVA/XGvasbSWHA++xaXOTYmlAtgaAIFaIyN7RZugSrKfYi3uszLBFTzKMgDetIsoJHpswLCtZnVA01CJ1eQg0bZKtiYQfgMiiauR+/hk/f74b/joAGikoC+8PGrbhNo+33m4w9sLNhx5aAAfzgL2G0k7AIy4XWh7RoWxHZhqvx3CncAVSOKv799uPHhxccfwS6KaEOKavzDI4iSTGgBXdaL+DvSfHB8CyHw+wZC5PcLhMSfH4IHIyuoqAMlboCwA/jVZ6KkiNuR0YrIOHVEVFRy5KDfPwe/HshyK7zeWft9zTFeJn1zLLE1/mBAJ8k+WUbim/2M586TC9LFp3fl24/Pj517dGuQKdziiTEd23+VINBwjJCvSyYcIeaiOCKdwHHPMaAmnIWDnphlpGwTiJ3NBKG3KuWTiFI6sciQW1Nr1BdiLJe3Ioi0Zd6cLbgnhtq0OXa2Go0v3bplgRedu3VrXAkOmrVpU+wgczaASH6d5PFKxhZ3FCEHGuHm+Natccwxr8f/xC8Fns770Me+MW/1uVUpnSzbmYL8OmPDUE6WOVuMMmx4IKya/eX+DMvWrkZ0qmVNy1SJFDdzppUaMNmujeISs9MRnTsv6zn48mg3+EV7LwTOj9aukLavS1q3c2emsjKlkL5EFyV3VW+Y67znfN5P73gbyUTus9Le7qCXLXcaw0HeSqhWNHw4pF6nJkF8KDxO1IZmhL3oz6g6m30tWTon1dxZ+L+TL8lHgTexTGlvLVdodRXZ1IygvDyHWr9Bp1WUx0MzqJxyWAfqbgoxNLCwsLKZss6ePX+2a6esA4kDmisXpg+j2MyZl6urZqYEW2BSgi6oks8DfQC6v9NHLAzoetONVJzEfk98SxuxiH9okivJX5eGN/1r2s+u5ad1ym7P2/Vm0I33I8g15v8x/IZ1WRHq+pKlaosnOYon91oW5ZaK/8Q17M0wirHGhQSNsQiiHnOQNFbRGb8LRdsptDRuQ7VDt71thAATshawbTWBYNBZiPr9gGTQfXTGv4Zi3DdoGQwYVC9D9IFt68GMdwpQL0ITaegnzUbewZhGEfeLZ0DWbdMLcaFHnQMFlzlIlpeUpZM66IDCEEtcPWyFKDIkI/B2kibXQZuNJ50Cb4FGsYQTRWdDaSlT9EYlRt4OcPcJID0RZEIy6EcyM+I5ME5zEZ75+RkglpuNnlBRU2adAxK4mPsnlStR1gCtkzka1VzKcJcerAoiEUNNYwh4diQaLJDNiPFIzuJxFpCRqATXIeLUoBQbMU1lJdMr7Pe4Byr9dUpAEQxRIEpEBfI7FxQUHG+HShfvdphULqgXjBwAAA==') format('woff2'),
  url('./font/iconfont.woff?t=1548037533565') format('woff'),
  url('./font/iconfont.ttf?t=1548037533565') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
  url('./font/iconfont.svg?t=1548037533565#iconfont') format('svg'); /* iOS 4.1- */
}

复制代码

请看清楚!

代码第四行:rl('data:application/x-font-w........没有加font路径,我这边没注意搞了半天才发现,ok,已解决

 类似资料: