# Object wx.getDeviceInfo()

> 基础库 2.20.1 开始支持，低版本需做[兼容处理](1003706)。

> __小程序插件__：支持，需要小程序基础库版本不低于 [2.21.3](1003706)
> 
> __微信 Windows 版__：支持
> 
> __微信 Mac 版__：支持
> 
> __微信 鸿蒙 OS 版__：支持

## 功能描述

获取设备基础信息

## 返回值

### Object


```json
[
  {
    "属性": "abi",
    "类型": "string",
    "说明": "应用（微信APP）二进制接口类型（仅 Android 支持）",
    "最低版本": ""
  },
  {
    "属性": "deviceAbi",
    "类型": "string",
    "说明": "设备二进制接口类型（仅 Android 支持）",
    "最低版本": "[2.25.1](1003706)"
  },
  {
    "属性": "benchmarkLevel",
    "类型": "number",
    "说明": "设备性能等级（仅 Android 支持）。取值为：-2 或 0（该设备无法运行小游戏），-1（性能未知），>=1（设备性能值，该值越高，设备性能越好，目前最高不到50）\n 注意：从基础库3.4.5开始，本返回值停止维护，请使用[wx.getDeviceBenchmarkInfo](/miniprogram/dev/api/base/system/wx.getDeviceBenchmarkInfo)获取设备性能等级",
    "最低版本": ""
  },
  {
    "属性": "brand",
    "类型": "string",
    "说明": "设备品牌",
    "最低版本": ""
  },
  {
    "属性": "model",
    "类型": "string",
    "说明": "设备型号。新机型刚推出一段时间会显示unknown，微信会尽快进行适配。",
    "最低版本": ""
  },
  {
    "属性": "system",
    "类型": "string",
    "说明": "操作系统及版本",
    "最低版本": ""
  },
  {
    "属性": "platform",
    "类型": "string",
    "说明": "客户端平台",
    "最低版本": "",
    "子项": [
      {
        "合法值": "ios",
        "说明": "iOS微信（包含 iPhone、iPad）"
      },
      {
        "合法值": "android",
        "说明": "Android微信"
      },
      {
        "合法值": "ohos",
        "说明": "HarmonyOS 手机端微信"
      },
      {
        "合法值": "ohos_pc",
        "说明": "HarmonyOS PC微信"
      },
      {
        "合法值": "windows",
        "说明": "Windows微信"
      },
      {
        "合法值": "mac",
        "说明": "macOS微信"
      },
      {
        "合法值": "devtools",
        "说明": "微信开发者工具"
      }
    ]
  },
  {
    "属性": "cpuType",
    "类型": "string",
    "说明": "设备 CPU 型号（仅 Android 支持）（Tips: GPU 型号可通过 WebGLRenderingContext.getExtension('WEBGL_debug_renderer_info') 来获取）",
    "最低版本": "[2.29.0](1003706)"
  },
  {
    "属性": "memorySize",
    "类型": "string",
    "说明": "设备内存大小，单位为 MB",
    "最低版本": "[2.30.0](1003706)"
  }
]
```

## 示例代码

```js
const deviceInfo = wx.getDeviceInfo()

console.log(deviceInfo.abi)
console.log(deviceInfo.benchmarkLevel)
console.log(deviceInfo.brand)
console.log(deviceInfo.model)
console.log(deviceInfo.platform)
console.log(deviceInfo.system)
```
