# wx.getDeviceBenchmarkInfo(Object object)

基础库 3.4.5 开始支持,低版本需做兼容处理

Promise 风格 调用:不支持

小程序插件:不支持

# 功能描述

获取设备性能得分和机型档位数据

# 参数

# Object object

属性 类型 默认值 必填 说明
success function 接口调用成功的回调函数
fail function 接口调用失败的回调函数
complete function 接口调用结束的回调函数(调用成功、失败都会执行)

# object.success 回调函数

# 参数
# Object res
属性 类型 说明 最低版本
benchmarkLevel number 设备性能等级。-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不超过50)
注意:设备的benchmarkLevel值不会随着时间的推移而变化
3.4.5
modelLevel number 设备机型档位。0(档位未知),1(高档机),2(中档机),3(低档机)
注意:设备的机型档位会随着时间的推移而变化,因此在使用时请谨慎对待;若业务逻辑依赖于机型档位,但担心受到机型档位变化的影响,请参考设备档位映射文档自行判断机型档位
3.4.5

# 示例代码

wx.getDeviceBenchmarkInfo({
  success (res) {
    console.log(res.benchmarkLevel)
    console.log(res.modelLevel)
  }
})