title: Taro.getSystemSetting()

sidebar_label: getSystemSetting

获取设备设置

支持情况:getSystemSetting - 图1 getSystemSetting - 图2 getSystemSetting - 图3

H5: 不支持 bluetoothEnabled、locationEnabled、wifiEnabled

参考文档

类型

  1. () => Result

参数

Result

参数 类型 必填 说明
bluetoothEnabled boolean 蓝牙的系统开关
locationEnabled boolean 地理位置的系统开关
wifiEnabled boolean Wi-Fi 的系统开关
deviceOrientation keyof DeviceOrientation 设备方向

DeviceOrientation

设备方向合法值

参数 说明
portrait 竖屏
landscape 横屏

示例代码

  1. const systemSetting = Taro.getSystemSetting()
  2. console.log(systemSetting.bluetoothEnabled)
  3. console.log(systemSetting.deviceOrientation)
  4. console.log(systemSetting.locationEnabled)
  5. console.log(systemSetting.wifiEnabled)