wxconfig

1.1.6 • Public • Published

wxconfig

one step config WeChat JS-SDK

HOW TO USE

1. import wxconfig

yarn add wxconfig

then

import wxconfig from 'wxconfig'

2. config & reRegist

const wxcInstance = wxconfig({
  authAPI: WX_GET_JS_API_SIGN,
  share: {
    dest: ['Timeline', 'AppMessage', 'QQ', 'Weibo', 'QZone'],
    title: 'share title',
    desc: 'share subtitle',
    link: location.href,
    imgUrl: '/share300x300.jpg',
    // success fn & cancle fn are optional
    success: () => {},
    cancle: () => {}
  },
  jsApiList: ['onMenuShareTimeline', 'orSomeOtherAPI']
})
 
// re-regist, for some reason you'll need it
wxcInstance.reRegist({
  title: 'another title',
  desc: 'another subtitle',
  link: location.href,
  imgUrl: '/anotherShare300x300.jpg'
})

Readme

Keywords

Package Sidebar

Install

npm i wxconfig

Weekly Downloads

1

Version

1.1.6

License

MIT

Unpacked Size

18.2 kB

Total Files

7

Last publish

Collaborators

  • gaoryrt