• Taro.getSystemInfoSync()
    • 示例代码
    • API支持度

    Taro.getSystemInfoSync()

    获取系统信息同步接口。

    同步返回参数说明:

    参数说明
    brand手机品牌
    model手机型号
    system操作系统版本
    pixelRatio设备像素比
    screenWidth屏幕宽度
    screenHeight屏幕高度
    windowWidth可使用窗口宽度
    windowHeight可使用窗口高度
    version微信版本号
    statusBarHeight状态栏的高度
    platform客户端平台
    language微信设置的语言
    fontSizeSetting用户字体大小设置。以“我-设置-通用-字体大小”中的设置为准,单位:px
    SDKVersion客户端基础库版本

    注意:H5 端不支持 version、statusBarHeight、fontSizeSetting、SDKVersion

    示例代码

    1. import Taro from '@tarojs/taro'
    2. const res = Taro.getSystemInfoSync()
    3. console.log(res.model)
    4. console.log(res.pixelRatio)
    5. console.log(res.windowWidth)
    6. console.log(res.windowHeight)
    7. console.log(res.language)
    8. console.log(res.version)
    9. console.log(res.platform)

    API支持度

    API微信小程序H5React Native
    Taro.getSystemInfoSync✔️✔️✔️