This commit is contained in:
2025-09-14 00:21:54 +08:00
commit d40b3bbd62
766 changed files with 36275 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
Page({
onShareAppMessage() {
return {
title: '动态加载字体',
path: 'packageAPI/pages/load-font-face/load-font-face',
};
},
data: {
fontFamily: 'Bitstream Vera Serif Bold',
loaded: false,
},
onLoad() {
this.setData({
loaded: false,
});
},
loadFontFace() {
const self = this;
xhs.loadFontFace({
family: this.data.fontFamily,
source: 'url("https://sungd.github.io/Pacifico.ttf")',
success(res) {
console.log(res.status);
self.setData({ loaded: true });
},
fail(res) {
console.log(res.status);
},
complete(res) {
console.log(res.status);
},
});
},
clear() {
this.setData({ loaded: false });
},
});