Skip to content

Commit e3bf852

Browse files
committed
docs(readme): update readme
1 parent 747fb04 commit e3bf852

File tree

1 file changed

+43
-21
lines changed

1 file changed

+43
-21
lines changed

README.md

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,60 @@
1010

1111
![](https://raw.githubusercontent.com/dreambo8563/static-assets/master/watcher2.png)
1212

13-
## Project setup
13+
**vue-device-detector** is a simple vue plugin to inspect the device type.
1414

15-
```
16-
npm install
17-
```
15+
- focus on mobile
16+
- vue friendly
17+
- strong typed
1818

19-
### Compiles and hot-reloads for development
19+
TODO:
2020

21-
```
22-
npm run serve
23-
```
21+
- [ ] add dingding api
22+
- [ ] add weixin api
2423

25-
### Compiles and minifies for production
24+
### Install
2625

27-
```
28-
npm run build
26+
```cmd
27+
npm install vue-device-detector --save
2928
```
3029

31-
### Run your tests
30+
### Quick Start
3231

33-
```
34-
npm run test
32+
```js
33+
import device from "vue-device-detector"
34+
Vue.use(device)
3535
```
3636

37-
### Lints and fixes files
37+
### Methods
3838

39-
```
40-
npm run lint
41-
```
39+
- this.\$device in Component context.
40+
- Vue.\$device in global.
41+
42+
### API list
4243

43-
### Customize configuration
44+
you can get the following properties under this.\$device
4445

45-
See [Configuration Reference](https://cli.vuejs.org/config/).
46+
```ts
47+
interface IDeviceDetector {
48+
ios: Boolean
49+
iphone: Boolean
50+
iphoneX: Boolean
51+
iPhoneXR: Boolean
52+
iPhoneXSMax: Boolean
53+
ipod: Boolean
54+
ipad: Boolean
55+
android: Boolean
56+
androidPhone: Boolean
57+
windows: Boolean
58+
mobile: Boolean
59+
}
60+
```
61+
62+
eg.
63+
on iphoneX
4664

47-
# vue-DeviceDetector
65+
```js
66+
console.log(this.$device.iphoneX) // true
67+
console.log(this.$device.ios) // true
68+
console.log(this.$device.android) // false
69+
```

0 commit comments

Comments
 (0)