From 679576df2bedc09cd199b6c16ec947e5a4408fb1 Mon Sep 17 00:00:00 2001 From: shaoyongjun Date: Fri, 8 Nov 2024 10:35:10 +0800 Subject: [PATCH] to:sync --- static/js/event/impl/RSizeEventImpl.js | 11 +++++++---- static/yanxuelu.html | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/static/js/event/impl/RSizeEventImpl.js b/static/js/event/impl/RSizeEventImpl.js index f66621b..4bb52dd 100644 --- a/static/js/event/impl/RSizeEventImpl.js +++ b/static/js/event/impl/RSizeEventImpl.js @@ -32,15 +32,18 @@ define(function (require, exports, module) { } + let dpr = getDpr(); //set 1rem = curClientW / designWidth (支持响应式) - let nowFrontSize = curClientW / designWidth + 'px'; + let nowFrontSize = '1px'; if (ctx.isTablet || ctx.isMobile || ctx.isIOS || ctx.isAndroid) { - let dpr = getDpr(); - curDoc.style.fontSize = dpr * nowFrontSize; + nowFrontSize = (curClientW / designWidth) * dpr + 'px'; } else { - curDoc.style.fontSize = nowFrontSize; + nowFrontSize = (curClientW / designWidth) + 'px'; } + // curDoc.style.fontSize = dpr * nowFrontSize; + curDoc.style.fontSize = nowFrontSize; + console.log("curClientW :", curClientW, "designWidth: ", designWidth, "-> ", nowFrontSize); let testDiv = document.getElementById("testDevice"); testDiv.innerText += "\ncurClientW: " + curClientW; diff --git a/static/yanxuelu.html b/static/yanxuelu.html index db0d8c9..1ad403b 100644 --- a/static/yanxuelu.html +++ b/static/yanxuelu.html @@ -33,7 +33,7 @@
-
+
测试
@@ -186,7 +186,7 @@
- +
@@ -205,8 +205,8 @@
-
-
+
+