one step config WeChat JS-SDK
yarn add wxconfig
then
import wxconfig from 'wxconfig'
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'
})