nginx下设置为 if ($request_filename ~* ^.*?.(eot|otf|ttf|woff|woff2|svg)$) { add_header Access-Control-Allow-Origin https://servicewechat.com; add_header ContentDisposition attachment; add_header ContentType application/octet-stream; }
loadFontFace加载失败原因?wx.loadFontFace({ family: 'webfont', source: 'url("../../style/SourceHanSansCN-Normal.ttf")', success: function (res) { console.log(res.status) // loaded }, fail: function (res) { console.log(res.status) // error } }); 如图 load阶段使用该api加载本地字体,报错 Failed to load local font resource /style/SourceHanSansCN-Normal.ttf net::ERR_CACHE_MISS 但是代码中success的回调正常,而且status为loaded 但是代码里无法引用font-family: 'webfont'
01-18