美文网首页前端
uniapp获取系统信息||设备信息||状态栏高度||导航栏高度

uniapp获取系统信息||设备信息||状态栏高度||导航栏高度

作者: forward | 来源:发表于2021-04-06 17:12 被阅读0次

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

相关文章

网友评论

    本文标题:uniapp获取系统信息||设备信息||状态栏高度||导航栏高度

    本文链接:https://www.haomeiwen.com/subject/stfekltx.html