Files
gitlink-forgeplus/public/react/src/modules/test/ShareTest.js
2020-03-09 00:40:16 +08:00

35 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
<!-- 微信sdk https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115 -->
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
*/
if(window.wx) {
wx.ready(function () { //需在用户可能点击分享按钮前就先调用
alert('got wx1')
wx.updateAppMessageShareData({
title: ' title', // 分享标题
desc: 'hello world', // 分享描述
link: 'https://www.educoder.net', // 分享链接该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: 'https://test-newweb.educoder.net/images/educoder/headNavLogo.png', // 分享图标
success: function () {
// 设置成功
}
})
});
// wx.onMenuShareAppMessage({
//             title:' title', // 分享标题
//             desc:'hello world', // 分享描述
//             link: 'https://www.educoder.net', //location.href, // 分享链接
//             imgUrl: 'https://pre-newweb.educoder.net/images/educoder/headNavLogo.png', // 分享图标
//             type: '', // 分享类型,music、video或link不填默认为link
//             dataUrl: '', // 如果type是music或video则要提供数据链接默认为空
//             success: function () { 
//                 // 用户确认分享后执行的回调函数
//             },
//             cancel: function () { 
//                 // 用户取消分享后执行的回调函数
//             }
//         });
}