next-vue-device-detector
v0.0.1
Published
A tiny device detector plugin of vue 3 for mobile
Downloads
2,668
Maintainers
Readme
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💻 📖 🚇 | | :---: |
This project follows the all-contributors specification. Contributions of any kind welcome!