Skip to content

Commit f45dbdb

Browse files
authored
Merge pull request #10 from dreambo8563/release
readme
2 parents 61de4c1 + 896f4be commit f45dbdb

File tree

2 files changed

+52
-25
lines changed

2 files changed

+52
-25
lines changed

README.md

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,64 @@
1111

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

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

16-
```
17-
npm install
18-
```
16+
- focus on mobile
17+
- vue friendly
18+
- strong typed
1919

20-
### Compiles and hot-reloads for development
20+
TODO:
2121

22-
```
23-
npm run serve
24-
```
22+
- [ ] add dingding api
23+
- [ ] add weixin api
2524

26-
### Compiles and minifies for production
25+
### Install
2726

28-
```
29-
npm run build
27+
```cmd
28+
npm install vue-device-detector --save
3029
```
3130

32-
### Run your tests
31+
### Quick Start
3332

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

38-
### Lints and fixes files
39-
40-
```
41-
npm run lint
38+
### Methods
39+
40+
- this.\$device in Component context.
41+
- Vue.\$device in global.
42+
43+
### API list
44+
45+
you can get the following properties under this.\$device
46+
47+
```ts
48+
interface IDeviceDetector {
49+
ios: Boolean
50+
iphone: Boolean
51+
iphoneX: Boolean
52+
iPhoneXR: Boolean
53+
iPhoneXSMax: Boolean
54+
ipod: Boolean
55+
ipad: Boolean
56+
android: Boolean
57+
androidPhone: Boolean
58+
windows: Boolean
59+
mobile: Boolean
60+
}
4261
```
4362

44-
### Customize configuration
45-
46-
See [Configuration Reference](https://cli.vuejs.org/config/).
47-
48-
# vue-DeviceDetector
63+
eg.
64+
on iphoneX
4965

66+
```js
67+
console.log(this.$device.iphoneX) // true
68+
console.log(this.$device.ios) // true
69+
console.log(this.$device.android) // false
70+
```
5071

5172
## License
52-
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdreambo8563%2Fvue-DeviceDetector.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdreambo8563%2Fvue-DeviceDetector?ref=badge_large)
73+
74+
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdreambo8563%2Fvue-DeviceDetector.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdreambo8563%2Fvue-DeviceDetector?ref=badge_large)

babel.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
module.exports = {
2-
presets: ["@vue/app"]
2+
presets: [
3+
"@vue/app",
4+
{
5+
useBuiltIns: false
6+
}
7+
]
38
};

0 commit comments

Comments
 (0)