mobile-device-detect
Advanced tools
Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "mobile-device-detect", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Helpers for handling mobile devices", | ||
@@ -12,2 +12,16 @@ "main": "dist/index.js", | ||
}, | ||
"keywords": [ | ||
"useragent", | ||
"mobile", | ||
"phone", | ||
"tablet", | ||
"detect", | ||
"device", | ||
"browser", | ||
"smart-tv", | ||
"smarttv", | ||
"version", | ||
"model", | ||
"console" | ||
], | ||
"scripts": { | ||
@@ -14,0 +28,0 @@ "start": "webpack --watch", |
@@ -17,6 +17,39 @@ ## mobile-device-detect | ||
## Usage | ||
import any helper to your component, and use it as you needed. | ||
For example, in Vue.js: | ||
In script section: | ||
```html | ||
<script> | ||
import { isMobile } from 'mobile-device-detect'; | ||
export default { | ||
name: 'HelloWorld', | ||
data () { | ||
return { | ||
msg: isMobile ? 'Welcome to Your Vue.js mobile App!' : 'Welcome to Your Vue.js App' | ||
} | ||
} | ||
} | ||
</script> | ||
``` | ||
pass it to template: | ||
```html | ||
<template> | ||
<div class="hello"> | ||
{{ msg }} | ||
</div> | ||
</template> | ||
``` | ||
For react example, you can look into separated package [react-device-detect](https://github.com/duskload/react-device-detect) | ||
### Selectors | ||
| prop | type | description | | ||
| Property | Return type | Description | | ||
| ------------------ | -------- | -------------------------------------------------------------------------------------- | | ||
@@ -23,0 +56,0 @@ | isMobile | bool | returns true if device type is `mobile` or `tablet` | |
37075
88