wx.loadFontFace方法中success回调为何执行三次?
- 当前 Bug 的表现(可附上截图)
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
wx.loadFontFace方法中success回调为何执行三次?
4 回复
uploadFonts: function (e) {
var fontUrl = e.currentTarget.dataset[‘item’].woff_url;
console.log(‘myload’)
wx.loadFontFace({
family: ‘webfont’,
source: ‘url(’ + fontUrl + ‘)’,
success: res => {
console.log(res)
clearInterval(timer)
this.setData({
})
},
fail: err => {
console.log(err)
clearInterval(timer)
wx.showToast({
icon: ‘none’,
title: ‘无法获取该字体,请重试’,
})
this.setData({
})
},
complete: res=>{
// console.log(res)
}
})
}
}
})
}