自定义微信分享内容
如何自定义微信分享的内容:
1、引入微信官方的库:
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
2、自定义分享内容:
var WXShare={ init:function(){ $.post("微信分享信息的接口(返回微信appid之类微信分享需要用到的账户信息)",function(data){ wx.config({ debug: false, appId: data.appId, timestamp: data.timestamp, nonceStr: data.nonceStr, signature: data.signature, jsApiList: [ 'checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'hideMenuItems', 'showMenuItems', 'hideAllNonBaseMenuItem' ] }); wx.ready(function(){ WXShare.share("描述","地址(绝对地址)","logo(绝对地址)"); }); },"json"); } ,share:function(title,desc,link,pic){ var wxData = { title: title, link: link, imgUrl: pic, desc: desc, success: function () { WXShare.end(); }, cancel: function () { WXShare.end(); } } var wxDataTimeline = { title: desc, link: link, imgUrl: pic, success: function () { WXShare.end(); }, cancel: function () { WXShare.end(); } } wx.onMenuShareTimeline(wxDataTimeline); wx.onMenuShareAppMessage(wxData); wx.onMenuShareQQ(wxData); wx.onMenuShareWeibo(wxData); }, end:function(){ stat("sharetowechat"); } }; WXShare.init();
- 支付宝
- 微信