小程序wx.getSystemSetting
Object wx.getSystemSetting()
獲取設(shè)備設(shè)置
基礎(chǔ)庫(kù) 2.20.1 開始支持,低版本需做兼容處理。
小程序插件:支持,需要小程序基礎(chǔ)庫(kù)版本不低于 2.21.3
返回值
Object
屬性 類型 說明
bluetoothEnabled boolean 藍(lán)牙的系統(tǒng)開關(guān)
locationEnabled boolean 地理位置的系統(tǒng)開關(guān)
wifiEnabled boolean Wi-Fi 的系統(tǒng)開關(guān)
deviceOrientation string 設(shè)備方向
合法值 說明
portrait 豎屏
landscape 橫屏
示例代碼
const systemSetting = wx.getSystemSetting()
console.log(systemSetting.bluetoothEnabled)
console.log(systemSetting.deviceOrientation)
console.log(systemSetting.locationEnabled)
console.log(systemSetting.wifiEnabled)
作者:大學(xué)生新聞網(wǎng) 來源:大學(xué)生新聞網(wǎng)
發(fā)布時(shí)間:2025-04-02 閱讀: