字体适配
This commit is contained in:
parent
ef0b91c95c
commit
434c3af16d
@ -24,6 +24,7 @@
|
||||
<!-- <div class="prize p-3" ref="p20"></div> -->
|
||||
</div>
|
||||
<!-- <div class="btn" @click="btn">开始抽奖</div> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user