1引入js文件
<script src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
2.调用接口获取权限
this.$axios.get('接口地址', {
params: {
url: '参数',
},
})
.then(function (res) {
wx.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: res.data.appid, // 必填,公众号的唯一标识
timestamp: res.data.timestamp, // 必填,生成签名的时间戳
nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
signature: res.data.signature, // 必填,签名
jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData'], // 必填,需要使用的JS接口列表
})
})
.catch(function (error) {
console.log(error)
})
},
3.调用分享
wx.ready(function () {
//需在用户可能点击分享按钮前就先调用
w