js安全域名,ip白名单都设置正确,在开发者工具测试也一切正常,到了真机无论是android还是IOS都不生效,点击右上角...分享就是当前页面链接。
代码如下
<script>
wx.config({
debug: true,
appId: 'wxc00af4f21bf89c8f',
timestamp: 1645502183,
nonceStr: 'YATtdJ6WzVE9f1lA',
signature: 'ab1adcd4b0b3fb1585ae9ff72be634953e55a6c6',
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'updateAppMessageShareData',
'updateTimelineShareData'
]
});
wx.ready(function() {
wx.checkJsApi({
jsApiList: [
'onMenuShareAppMessage',
'onMenuShareTimeline',
'updateAppMessageShareData',
'updateTimelineShareData'
],
success: function(res) {
alert(JSON.stringify(res));
console.log(res)
},
fail:function(res){
alert(JSON.stringify(res));
console.log(res)
}
});
/*wx.onMenuShareAppMessage({
title: '分享标题', // 分享标题
desc: '分享描述分享描述分享描述。', // 分享描述
link: window.location.href,
type:'link',
img_url: 'https://t.course.dajishizhijia.com/wx/tiger.jpg', // 分享图标
success: function() {
alert('onMenuShareAppMessage success');
},
cancel: function() {
alert('cancel');
},
fail: function(res) {
alert('fail:'+JSON.stringify(res));
console.log(res)
}
});*/
wx.updateAppMessageShareData({
title: '分享标题', // 分享标题
desc: '分享描述分享描述分享描述。', // 分享描述
link: window.location.href,
type:'link',
imgUrl: 'https://t.course.dajishizhijia.com/wx/tiger.jpg', // 分享图标
success: function() {
alert('updateAppMessageShareData success');
},
cancel: function() {
alert('cancel');
},
fail: function(res) {
alert('fail'+JSON.stringify(res));
console.log(res)
}
});
});
wx.error(function(res) {
alert(res.errMsg);
console.log(res)
});
</script>