Install
npm i share-wechat
Validate Usage
import wechat isWeChat wechatShare from 'share-wechat'; { ; } { ... }
Api
wechat(configs, shareData, url)
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
configs | 微信config参数,{ debug, appId, timestamp, nonceStr, signature, jsApiList('默认包含所有分享') } | Object | 必填 |
shareData | 分享参数,同下面 wechatShare 参数, { data, success, cancel } | Object | 非必填 |
url | 微信的引入JS文件,默认为 http://res.wx.qq.com/open/js/jweixin-1.0.0.js | string | 非必填 |
wechatShare(data, success, cancel)
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
data | 微信分享设置,{ title, link, imgUrl, desc } | Object | 必填 |
success | 分享成功回调 | function | 非必填 |
cancel | 取消分享回调 | function | 非必填 |
isWeChat()
判断是否微信环境