Element-UI字体图标不显示
2019-06-11 本文已影响0人
lesdom
原因
我在控制台查看请求后,发现elementUI的字体文件请求路径不对,
我的路径是/static/css/static/fonts/element-icons.535877f.woff
,
正确的是/static/fonts/element-icons.535877f.woff
解决
build - utils
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader',
publicPath: '../../' // 加上这句话
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}
文档
https://github.com/vuejs-templates/webpack/issues/166