A device detector plugin of Vue 3
npm install @basitcodeenv/vue3-device-detect




Detect device type and render content based on device type
Install using
```
npm install @basitcodeenv/vue3-device-detect --save
Then, initalize the plugin in the starting point of your app (most likely src/main.js):
`ts`
// main.ts
import VueDeviceDetect from '@basitcodeenv/vue3-device-detect'
Vue.use(vueDeviceDetect)
This will globally register the components DesktopView, MobileView and others and you will be able to use those right away.
`html
This is rendered only in desktop browser
This is rendered only on mobile
`
Build-in components:
AndroidView
ChromeView
ChromiumView
ConsoleView
DesktopView
EdgeChromiumView
EdgeLegacyView
EdgeView
ElectronView
EmbeddedView
FirefoxView
IEView
IOSView
IPadView
IPhoneView
IPodView
LinuxView
MacOSView
MIUIView
MobileOnlyView
MobileSafariView
MobileView
OperaView
SafariView
SamsungBrowserView
SmartTVView
TabletView
WearableView
WindowsView
WinPhoneView
YandexView
You can also determine through the built-in API
`ts`
// main.ts
import { isMobile } from '@basitcodeenv/vue3-device-detect'
Properties:
| name | type | description |
| ---------------- | ------- | --------------------------------------- |
| isAndroid | boolean | The OS is Android |Chrome
| isChrome | boolean | Browser is |Chromium
| isChromium | boolean | Browser is |console
| isConsole | boolean | The device type is |desktop
| isDesktop | boolean | The device type is |Edge
| isEdge | boolean | Browser is or Edge Chromium |Edge Chromium
| isEdgeChromium | boolean | Browser is |Edge
| isEdgeLegacy | boolean | Browser is |Electron
| isElectron | boolean | Browser is |embedded
| isEmbedded | boolean | The device type is |Firefox
| isFirefox | boolean | Browser is |Internet Explorer
| isIE | boolean | Browser is |iOS
| isIOS | boolean | The OS is |iPad
| isIPad | boolean | is |iPhone
| isIPhone | boolean | is |iPod
| isIPod | boolean | is |Linux
| isLinux | boolean | The OS is |Mac OS
| isMacOS | boolean | The OS is |MIUI Browser
| isMIUI | boolean | Browser is |mobile
| isMobile | boolean | The device type is or tablet |mobile
| isMobileOnly | boolean | The device type is |Mobile Safari
| isMobileSafari | boolean | Browser is |Opera
| isOpera | boolean | Browser is |Safari
| isSafari | boolean | Browser is |Samsung Browser
| isSamsungBrowser | boolean | Browser is |smarttv
| isSmartTV | boolean | The device type is |tablet
| isTablet | boolean | The device type is |wearable
| isWearable | boolean | The device type is |Windows
| isWindows | boolean | The OS is |Windows Phone
| isWinPhone | boolean | The OS is |Yandex Browser
| isYandex | boolean | Browser is |
Functions:
| name | return type | description |
| -------------- | ----------- | ------------------------------------------------------------------------ |
| browserName | string | Return browser name |
| browserVersion | string | Return browser version |
| deviceModel | string | Return mobile device type (e.g Nexus 5) |mobile
| deviceType | string | Return device type ( or tablet) |LG
| deviceVendor | string | Return mobile phone brand (e.g , Apple iPhone etc) |Gecko
| engineName | string | Return browser engine name (e.g for Firefox, Blink` for Chrome) |
| engineVersion | string | Return browser engine version |
| getUA | string | Return user agent |
| osName | string | Return OS name |
| osVersion | string | Return OS version |