Skip to content

getScreenInfo ​

获取屏幕、视口、设备像素相关完整信息

引入版本 ​

0.115.0

Demo ​

ts
import { getScreenInfo } from '@wyfex/iutils'

console.log(getScreenInfo())
// {
//     "raw": {
//         "screenWidth": 2880,
//         "screenHeight": 1920,
//         "availWidth": 2880,
//         "availHeight": 1872,
//         "innerWidth": 2182,
//         "innerHeight": 1751,
//         "devicePixelRatio": 1,
//         "outerWidth": 2880,
//         "outerHeight": 1872,
//         "screenLeft": 0,
//         "screenTop": 0,
//         "colorDepth": 24,
//         "pixelDepth": 24,
//         "refreshRate": null,
//         "browserZoom": 132
//     },
//     "基础屏幕尺寸": "2880 * 1920",
//     "可用屏幕尺寸": "2880 * 1872",
//     "可见区域尺寸": "2182 * 1751",
//     "浏览器窗口尺寸": "2880 * 1872",
//     "物理分辨率": "2880 * 1920",
//     "设备像素比": "1",
//     "屏幕色深": 24,
//     "像素深度": 24,
//     "窗口偏移位置": "0 * 0",
//     "是否高分屏": false,
//     "是否横屏": true,
//     "是否触摸设备": true,
//     "是否多显示器扩展屏": true,
//     "屏幕刷新率": null,
//     "浏览器缩放比例": "132%",
//     "设备方向": "landscape",
//     "安全区域": {
//         "top": "0px",
//         "right": "0px",
//         "bottom": "0px",
//         "left": "0px"
//     },
//     "当前响应式断点": "xl"
// }

基于 MIT 许可发布