获取系统分辨率适配

parent 96056b49
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -30,4 +30,4 @@
"vite": "^2.9.9",
"vite-plugin-style-import": "^0.10.1"
}
}
\ No newline at end of file
}
......@@ -27,6 +27,17 @@ class DevicePixelRatio {
let t = this;
//页面devicePixelRatio(设备像素比例)变化后,计算页面body标签zoom修改其大小,来抵消devicePixelRatio带来的变化。
document.getElementById('main').style.zoom = 1 / window.devicePixelRatio;
t._bodyScale()
}
_bodyScale() {
let flag = false;
var agent = navigator.userAgent.toLowerCase();
if (agent.indexOf("windows") >= 0) {
flag = true;
}
if (flag) {}
var scale = window.screen.width / 1920*1.25; // 分母——设计稿的尺寸
document.getElementById('main').style.zoom = scale; //放大缩小相应倍数
}
//监听页面缩放
_watch() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment