小程序wx.getDeviceInfo
	   Object wx.getDeviceInfo()
獲取設(shè)備基礎(chǔ)信息
基礎(chǔ)庫(kù) 2.20.1 開始支持,低版本需做兼容處理。
小程序插件:支持,需要小程序基礎(chǔ)庫(kù)版本不低于 2.21.3
返回值
Object
屬性    類型    說(shuō)明
abi    string    應(yīng)用二進(jìn)制接口類型(僅 Android 支持)
benchmarkLevel    number    設(shè)備性能等級(jí)(僅 Android 支持)。取值為:-2 或 0(該設(shè)備無(wú)法運(yùn)行小游戲),-1(性能未知),>=1(設(shè)備性能值,該值越高,設(shè)備性能越好,目前最高不到50)
brand    string    設(shè)備品牌
model    string    設(shè)備型號(hào)。新機(jī)型剛推出一段時(shí)間會(huì)顯示unknown,微信會(huì)盡快進(jìn)行適配。
system    string    操作系統(tǒng)及版本
platform    string    客戶端平臺(tái)
示例代碼
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)
	   
 作者:大學(xué)生新聞網(wǎng)    來(lái)源:大學(xué)生新聞網(wǎng)
發(fā)布時(shí)間:2025-04-02    閱讀:
 
 
 
 
  
- 小程序wx.getSystemInfo
 
- 獲取系統(tǒng)信息。由于歷史原因,wx.getSystemInfo 是異步的調(diào)用格式,但是是同步返回,需要異步獲取系統(tǒng)信息請(qǐng)使用 wx.getSystemInfoAsy
 
- 04-02 關(guān)注:0