Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace device

description

设备

author

zhangxinyu 2022.11.24

Index

Type aliases

KitBrowserInfo

KitBrowserInfo: { browser: "chrome" | "safari" | "firefox" | "opera" | "edge" | "ie"; browserVersion: string; engine: "webkit" | "gecko" | "presto" | "trident"; engineVersion: string; shell: "wechat" | "qq" | "uc" | "360" | "2345" | "sougou" | "liebao" | "maxthon"; shellVersion: string }

浏览器信息

Type declaration

  • browser: "chrome" | "safari" | "firefox" | "opera" | "edge" | "ie"

    浏览器载体

  • browserVersion: string

    浏览器载体版本

  • engine: "webkit" | "gecko" | "presto" | "trident"

    浏览器内核

  • engineVersion: string

    浏览器内核版本

  • shell: "wechat" | "qq" | "uc" | "360" | "2345" | "sougou" | "liebao" | "maxthon"

    浏览器外壳

  • shellVersion: string

    浏览器外壳版本

KitSystemInfo

KitSystemInfo: { system: "windows" | "macos" | "linux" | "android" | "ios"; systemVersion: string }

系统信息

Type declaration

  • system: "windows" | "macos" | "linux" | "android" | "ios"

    系统

  • systemVersion: string

    系统版本

Functions

getBrowserInfo

  • 获取当前运行浏览器信息

    Returns KitBrowserInfo

    浏览器信息

getDeviceDpr

  • getDeviceDpr(): number
  • 获取设备dpr

    Returns number

    设备dpr

getDeviceHeight

  • getDeviceHeight(): number
  • 获取设备高度

    Returns number

    设备高度

getDeviceInfo

  • 获取当前运行设备信息

    Returns KitSystemInfo & KitBrowserInfo

    系统信息 + 浏览器信息

getDeviceWidth

  • getDeviceWidth(): number
  • 获取设备宽度

    Returns number

    设备宽度

getSystemInfo

  • 获取当前运行系统信息

    Returns KitSystemInfo

    系统信息

isMobile

  • isMobile(): boolean
  • 判断设备是否为移动端

    Returns boolean

    是否为移动端

setDeviceRem

  • setDeviceRem(mobileFitSize?: number, pcFitSize?: number, pcMinWidth?: number): void
  • 根据设计稿宽度设定rem

    Parameters

    • Optional mobileFitSize: number

      移动端设计稿宽度(px)

    • Optional pcFitSize: number

      pc端设计稿宽度(px)

    • Optional pcMinWidth: number

      pc端最小适配宽度(px)

    Returns void