wx.loadFontFace 可以在 app.js的onLaunch里调用吗?

发布于 8 年前作者 nma3931 次浏览最后编辑 8 年前来自 issues



App({
  onLaunch: function () {
    wx.loadFontFace({
      family: 'Bitstream Vera Serif Bold',
      source: 'url("https://sungd.github.io/Pacifico.ttf")',
      success(res) {
        console.log(res.status)
        
      },
      fail: function (res) {
        console.log(res.status)
      },
      complete: function (res) {
        console.log(res.status)
      }
    });
  }
})

我这个字体是全局都在用的,我可以这样写吗?

2 回复
xiaxie
xiaxie1 楼6 年前

我这样写,这个加载字体的请求就没有发送出去呢

xiulanshen
xiulanshen2 楼6 年前

我也是这样写的,但是我发现不是所有页面都有效,所以我也很纳闷,难道要在每个需要用的的地方都加载一次么?