Skip to main content
Version: 3.x

Taro.getSystemSetting()

获取设备设置

支持情况:

H5: 不支持 bluetoothEnabled、locationEnabled、wifiEnabled

参考文档

类型

() => Result

参数

Result

参数类型必填说明
bluetoothEnabledboolean蓝牙的系统开关
locationEnabledboolean地理位置的系统开关
wifiEnabledbooleanWi-Fi 的系统开关
deviceOrientationkeyof DeviceOrientation设备方向

DeviceOrientation

设备方向合法值

参数说明
portrait竖屏
landscape横屏

示例代码

const systemSetting = Taro.getSystemSetting()

console.log(systemSetting.bluetoothEnabled)
console.log(systemSetting.deviceOrientation)
console.log(systemSetting.locationEnabled)
console.log(systemSetting.wifiEnabled)