-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
Version
undefined
Environment
无
Reproduction link
https://www.jb51.net/article/267677.htm
Steps to reproduce
无地址
What is expected?
export const detectZoom = () => {
let ratio = 0,
screen = window.screen,
ua = navigator.userAgent.toLowerCase();
if (window.devicePixelRatio !== undefined) {
ratio = window.devicePixelRatio;
} else if (~ua.indexOf("msie")) {
if (screen.deviceXDPI && screen.logicalXDPI) {
ratio = screen.deviceXDPI / screen.logicalXDPI;
}
} else if (
window.outerWidth !== undefined &&
window.innerWidth !== undefined
) {
ratio = window.outerWidth / window.innerWidth;
}
if (ratio) {
ratio = Math.round(ratio * 100);
}
return ratio;
};
// 屏幕自适应适配
import { detectZoom } from "/@/utils/detectZoom.js";
const m = detectZoom();
document.body.style.zoom = String((window.screen.width * (m / 100) / 1920) * (100 / Number(m)))
电脑控制面板-显示设置-缩放与布局为150%,在谷歌浏览器128版本下页面正常显示,但下拉选择,日期选择等相关选择控件弹出位置偏移错乱。
What is actually happening?
下拉选择,日期选择等相关选择控件位置正常显示,不要偏移