字体适配

This commit is contained in:
tcubic 2022-08-05 17:01:41 +08:00
parent ef0b91c95c
commit 434c3af16d
2 changed files with 28 additions and 1 deletions

View File

@ -24,6 +24,7 @@
<!-- <div class="prize p-3" ref="p20"></div> -->
</div>
<!-- <div class="btn" @click="btn">开始抽奖</div> -->
</div>
</div>
</template>

View File

@ -210,7 +210,9 @@ onBeforeMount(() => {
});
//
onMounted(() => {});
onMounted(() => {
fontAdpat()
});
//
const indexPage = (actions) => {
@ -284,6 +286,30 @@ const pageImgsArrLoad = (imgs) => {
});
return Promise.all(promiseArr);
};
//
const fontAdpat = ()=>{
if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
handleFontSize();
} else {
if (document.addEventListener) {
document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
} else if (document.attachEvent) {
document.attachEvent("onWeixinJSBridgeReady", handleFontSize);
}
}
function handleFontSize() {
//
WeixinJSBridge.invoke('setFontSizeCallback', { 'fontSize' : 0 });
//
WeixinJSBridge.on('menu:setfont', function() {
WeixinJSBridge.invoke('setFontSizeCallback', { 'fontSize' : 0 });
});
}
}
</script>
<style lang="scss" scoped>