next-vue-device-detector
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

License: MIT npm type definitions npm

Next-vue-device-detector

next-vue-device-detector is a simple vue plugin to inspect the device type.

  • focus on mobile
  • vue 3 friendly
  • strong typed

Install

npm install next-vue-device-detector --save

Quick Start

import { createDeviceDetector } from "next-vue-device-detector";

export const device = createDeviceDetector()
createApp(App).use(device).mount('#app')

Methods

  • In Setup()
    const d = useDevice()
    console.log(d.android, "in setup");
  • Outside Setup()
import { createDeviceDetector } from "next-vue-device-detector";

export const device = createDeviceDetector()
createApp(App).use(device).mount('#app')
console.log(device.android);

API list

you can get the following properties under device

interface IDeviceDetector {
  ios: Boolean
  iphone: Boolean
  iphoneX: Boolean
  iPhoneXR: Boolean
  iPhoneXSMax: Boolean
  ipod: Boolean
  ipad: Boolean
  android: Boolean
  androidPhone: Boolean
  windows: Boolean
  mobile: Boolean
  dingding: Boolean //钉钉
  wechat: Boolean, // 微信
  wechatMiniApp: Boolean //微信小程序
}

eg. on iphoneX

const device = useDevice()

console.log(device.iphoneX) // true
console.log(device.ios) // true
console.log(device.android) // false

Contributors

Thanks goes to these wonderful people (emoji key):

Vincent Guo
Vincent Guo

💻 📖 🚇

This project follows the all-contributors specification. Contributions of any kind welcome!

Dependents (2)

Package Sidebar

Install

npm i next-vue-device-detector

Weekly Downloads

761

Version

0.0.1

License

ISC

Unpacked Size

10.4 kB

Total Files

9

Last publish

Collaborators

  • dreambo8563