Compass helpers for browser platforms
    Preparing search index...

    Function isDeviceType

    • Parameters

      • deviceType:
            | "mobile"
            | "tablet"
            | "desktop"
            | "harmonyos"
            | "android"
            | "ios"
            | "macos"
            | "windows"
            | "linux"

        设备类型

      • Optionaloptions: DeviceDetectionOptions

        检测选项

      Returns boolean

      是否为指定设备类型

      检查是否为特定设备类型

      // 检查是否为移动设备
      if (isDeviceType('mobile')) {
      console.log('当前是移动设备');
      }

      // 检查是否为特定操作系统
      if (isDeviceType('ios')) {
      console.log('当前是 iOS 设备');
      }