@jarvisniu/vue-ua
v0.1.3
Published
Vue plugin to detect web environment by user-agent
Downloads
3
Readme
vue-ua
Vue plugin to detect web environment by user agent
Usage
Install:
npm install @jarvisniu/vue-ua
Import:
import Vue from 'vue'
import VueUA from '@jarvisniu/vue-ua'
// Simple usage
Vue.use(VueUA)
// With extending
Vue.use(VueUA, function (ua) {
ua.isOpera = ua.value.includes('OPR/')
})
Use in template:
<div v-if="$ua.isWindows">This is Windows</div>
Use in script:
this.$ua.isWindows
// or
Vue.prototype.$ua.isWindows
API
- OS
- isWindows
- isMacOS
- isLinux
- isUbuntu
- isAndroid
- isIOS
- Kernel
- isChrome
- isFirefox
- isSafari
- isEdge
- isIE
- Platform
- isElectron
- isDesktop
- isMobile
- In-App
- isWechat
- isAlipay
License
MIT