全局字体样式引入无效
- 当前 Bug 的表现(可附上截图)
在 app.js 中进行引入网络字体样式,代码如下:
onLaunch: function () { wx.loadFontFace({ family: 'HYZhengYuan', source: 'url("https://xxx.com/fonts/HYZhengYuan-45W-2.otf")', success: function (res) { console.log("字体加载成功:" + res.status) // loaded }, fail: function (res) { console.log("字体加载 error:" + res.status) // error }, complete: function (res) { console.log("字体加载:" + res.status); } });} |
随后在 app.wxss 中配置字体样式:
page { background-color:#F7F7F7; height:100%; font-family: HYZhengYuan !important;} |
发现只有 index 页面下除 textarea 引入无效之外,其他内容均应用字体样式成功,但是其他的页面则引用无效。
在模拟器中演示效果正确,但在实际真机上,textarea 无效,部分截图如下:
以下为测试设备型号:
模拟器:iPhone X
真机:iPhone XS MAX
- 预期表现
在全局 app.js 加载字体样式,并在 app.wxss 中引用后,当前小程序字体样式随即变更。
-
复现路径
-
提供一个最简复现 Demo
