1.2.1 • Published 5 years ago

share-wechat v1.2.1

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

Install

    npm i share-wechat

Validate Usage

    import wechat, { isWeChat, wechatShare } from 'share-wechat';

    export default class Home extends Component {
        componentDidMount () {
            wechat({
                appId:"wx131a2112efd76636",
                nonceStr:"4eb74bb9-53b7-4eb4-96...",
                signature:"c859696a20f6a40e6929...",
                timestamp:"1513240727...",
                url:"url"
            }, {
                data : {
                    title: '分享标题', 
                    desc: '分享描述', 
                    link: '分享链接', 
                    imgUrl: '分享图标', 
                },
                success: {

                },
                cancel: {

                }
            }).then(() => {
                console.log('success');
            }).catch(() => {
                ...
            });
        }

        render() {
            ...
        }
    }

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.jsstring非必填

wechatShare(data, success, cancel)

属性说明类型默认值
data微信分享设置,{ title, link, imgUrl, desc }Object必填
success分享成功回调function非必填
cancel取消分享回调function非必填

isWeChat()

判断是否微信环境

1.2.1

5 years ago

1.2.0

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago