uni.getSystemInfo() 获取系统信息
uni.getSystemInfo({
success: function (res) {
console.log(res.statusBarHeight)//状态栏的高度 字节跳动小程序不支持
console.log(res.navigationBarHeight)//导航栏的高度
console.log(res.model); //手机型号
console.log(res.pixelRatio);//设备像素比
console.log(res.windowWidth);//可使用窗口宽度
console.log(res.windowHeight);//可使用窗口高度
console.log(res.language);//应用设置的语言
console.log(res.version);//引擎版本号
console.log(res.platform);//客户端平台,值域为:ios、android
}
});
uni.getSystemInfo() 获取系统信息同步接口。
const res = uni.getSystemInfoSync();
console.log(res.model); //手机型号
console.log(res.pixelRatio);//设备像素比
console.log(res.windowWidth);//可使用窗口宽度
console.log(res.windowHeight);//可使用窗口高度
console.log(res.language);//应用设置的语言
console.log(res.version);//引擎版本号
console.log(res.platform);//客户端平台,值域为:ios、android