字符图标无法显示的原因有哪些?
比如uikit的uk-icon-button uk-icon-weibo样式字体符号在我自己写的web框架下无法显示,但是直接打开是可以显示的。本来应该是
但是在我搭建的服务器下显示是
注:这段代码是我响应静态文件的中间件
javascript
exports.staticFile = function(req, res, next){ var ROOT = './'; var PATH = url.parse(req.url).pathname; var pathname = PATH.slice(PATH.lastIndexOf('static')); var contenType = mime.lookup(pathname); var woff = /^static\/fonts\/.*$/g; if(woff.test(pathname)){ contenType = "application/octet-stream"; } fs.readFile(path.join(ROOT, pathname), 'utf8', function(err, file){ if(err){ return next(err); } res.setHeader("Access-Control-Allow-Origin", "*"); res.setHeader("Content-Type", contenType +';charset=utf8'); res.end(file); next(); }); };
vicent
9 years, 8 months ago