import jWeixin from '../../uni_modules/jweixin-module/lib/index.js'
jWeixin.config({
debug: true, //调试模式
appId: res.data.data
.appId, //res[1].data.appId, //必填,公众号的唯一标识
timestamp: res.data.data
.timestamp, //res[1].data.timestamp, //必填,生成签名的时间戳
nonceStr: res.data.data
.noncestr, //res[1].data.nonceStr, //必填,生成签名的随机串
signature: res.data.data
.signature, //res[1].data.signature, //必填,签名
jsApiList: [
'updateTimelineShareData',
'updateAppMessageShareData',
'onMenuShareAppMessage',
'onMenuShareTimeline'
] //必填,需要使用的JS接口列表`
})
window.share_config = { //自定义分享内容
share: {
imgUrl: _this.DescData.ban, //分享图标
desc: _this.DescData.name, //分享介绍
title: _this.DescData.sub_title, //分享标题
link: _this.linkUrl, //分享网址
success: function(res) {
console.log(res, '分享')
},
}
}
jWeixin.ready(function() {
jWeixin.updateTimelineShareData(window.share_config.share) //分享微信朋友圈
jWeixin.updateAppMessageShareData(window.share_config.share) //分享微信好友
})
index.js需要先下载然后引入:http://res.wx.qq.com/open/js/jweixin-1.6.0.js