|
@@ -120,8 +120,10 @@
|
|
|
doc.write(wrap.innerHTML);
|
|
|
}
|
|
|
}
|
|
|
+ var index = 0;
|
|
|
|
|
|
function refreshRem() {
|
|
|
+ var docEl = doc.documentElement;
|
|
|
var width = docEl.getBoundingClientRect().width;
|
|
|
if (width / dpr > 5760) {
|
|
|
width = 5760 * dpr;
|
|
@@ -129,26 +131,45 @@
|
|
|
var rem = width / 10;
|
|
|
docEl.style.fontSize = rem + 'px';
|
|
|
flexible.rem = win.rem = rem;
|
|
|
- }
|
|
|
+ var isMac = (navigator.platform == "Mac68K") || (navigator.platform == "MacPPC") || (navigator.platform == "Macintosh") || (navigator.platform == "MacIntel");
|
|
|
+ var t = window.devicePixelRatio // 获取下载的缩放 125% -> 1.25 150% -> 1.5
|
|
|
+ console.log(t)
|
|
|
+ if (t != 1 && !isMac) { // 如果进行了缩放,也就是不是1
|
|
|
+ setTimeout(() => {
|
|
|
+ document.body.style.zoom = -0.6 * t + 1.55; // 就去修改页面的缩放比例,这个公式我自己算的,不准确,勉强。
|
|
|
+ }, 3 * 1000)
|
|
|
+ } else {
|
|
|
+ document.body.style.zoom = "normal";
|
|
|
+ }
|
|
|
|
|
|
- // win.addEventListener(
|
|
|
- // 'resize',
|
|
|
- // function() {
|
|
|
- // clearTimeout(tid);
|
|
|
- // tid = setTimeout(refreshRem, 300);
|
|
|
- // },
|
|
|
- // false,
|
|
|
- // );
|
|
|
- // win.addEventListener(
|
|
|
- // 'pageshow',
|
|
|
- // function(e) {
|
|
|
- // if (e.persisted) {
|
|
|
- // clearTimeout(tid);
|
|
|
- // tid = setTimeout(refreshRem, 300);
|
|
|
- // }
|
|
|
- // },
|
|
|
- // false,
|
|
|
- // );
|
|
|
+
|
|
|
+ }
|
|
|
+ // window.onresize = () => {
|
|
|
+
|
|
|
+ // // refreshRem()
|
|
|
+ // }
|
|
|
+
|
|
|
+ win.addEventListener(
|
|
|
+ 'resize',
|
|
|
+ function() {
|
|
|
+ // debugger
|
|
|
+ clearTimeout(tid);
|
|
|
+ tid = setTimeout(refreshRem, 300);
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ false,
|
|
|
+ );
|
|
|
+ win.addEventListener(
|
|
|
+ 'pageshow',
|
|
|
+ function(e) {
|
|
|
+ if (e.persisted) {
|
|
|
+ clearTimeout(tid);
|
|
|
+ tid = setTimeout(refreshRem, 300);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ false,
|
|
|
+ );
|
|
|
|
|
|
if (doc.readyState === 'complete') {
|
|
|
doc.body.style.fontSize = 12 * dpr + 'px';
|
|
@@ -187,7 +208,7 @@
|
|
|
<body style="position: fixed;background-color: #112692;
|
|
|
width: 100%;
|
|
|
height: 100%;">
|
|
|
- <div id="app"></div>
|
|
|
+ <div id="app" style="height: 100%;"></div>
|
|
|
<script type="module" src="/src/main.ts"></script>
|
|
|
</body>
|
|
|
|