1.0.0 • Published 7 years ago
sd-platform v1.0.0
sd-platform
水滴客户端平台判断工具
INSTALL
yarn add sd-platformUSEAGE
ua非必填,非node环境默认为navigator.userAgent
Javascript/Node.js
import {platform} from 'sd-platform'
console.log(platform([ua]).isBrowser([ua]))VUE
import platform from 'sd-platform'
Vue.use(platform, [ua])
// 是否为微信
this.$sdplatform.isWechat()
// 或者重置参数
this.$sdplatform.isWechat(ua)API
| 方法名 | 参数类型 | 是否必填 | 描述 |
|---|---|---|---|
| isWxmp | String | 否 | 是否为微信小程序 |
| isQQmp | String | 否 | 是否为QQ小程序 |
| isWechat | String | 否 | 是否为微信 |
| isWeibo | String | 否 | 是否为微博 |
| isAndroid | String | 否 | 是否为安卓 |
| isIOS | String | 否 | 是否为IOS |
| isBrowser | String | 否 | 是否为浏览器 |
| isNode | 无 | 否 | 是否为Nodejs环境 |