腾讯对外分享组件接口文档

http://open.mobile.qq.com/api/component/share

组件地址

http://qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js

组件功能

定制微信,手机QQ,QQ空间APP内的分享内容。

组件接口


/** * 定制接口 * @param opts 定制内容 */ setShareInfo({ title: '父爱,在你看不到的地方', // 分享标题 summary: '父爱如山,感觉不到只因身在此山中', // 分享内容 pic: 'http://qzonestyle.gtimg.cn/aoi/sola/20150617094556_OvfOpoRKRB.png', // 分享图片 url: 'http://qzs.qzone.qq.com/qzone/qzact/act/2015/father-day-m/index.html', // 分享链接 // 微信权限验证配置信息,若不在微信传播,可忽略 WXconfig: { swapTitleInWX: true, // 是否标题内容互换(仅朋友圈,因朋友圈内只显示标题) appId: appId, // 公众号的唯一标识 timestamp: timestamp, // 生成签名的时间戳 nonceStr: nonceStr, // 生成签名的随机串 signature: signature // 签名 } });

未使用模块加载器

<script type="text/javascript" src="http://qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js"></script>
<script type="text/javascript">
     setShareInfo({
         title:          '父爱,在你看不到的地方',
         summary:        '父爱如山,感觉不到只因身在此山中',
         pic:            'http://qzonestyle.gtimg.cn/aoi/sola/20150617094556_OvfOpoRKRB.png',
         url:            'http://qzs.qzone.qq.com//qzone/qzact/act/2015/father-day-m/index.html',
         WXconfig:       {
             swapTitleInWX: true,
             appId: '',
             timestamp: '',
             nonceStr: '',
             signature: ''
         }
     });
</script>

使用seajs

seajs.use('http://qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js', function(setShareInfo) {
     setShareInfo({
         title:          '父爱,在你看不到的地方1',
         summary:        '父爱如山,感觉不到只因身在此山中2',
         pic:            'http://qzonestyle.gtimg.cn/aoi/sola/20150617094556_OvfOpoRKRB.png',
         url:            'http://qzs.qzone.qq.com//qzone/qzact/act/2015/father-day-m/index.html',
         WXconfig:       {
             swapTitleInWX: true,
             appId: '',
             timestamp:'',
             nonceStr: '',
             signature: ''
         }
     });
});

使用requirejs

require(['http://qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js'], function(setShareInfo) {
    setShareInfo({
        title:          '父爱,在你看不到的地方',
        summary:        '父爱如山,感觉不到只因身在此山中',
        pic:            'http://qzonestyle.gtimg.cn/aoi/sola/20150617094556_OvfOpoRKRB.png',
        url:            'http://qzs.qzone.qq.com//qzone/qzact/act/2015/father-day-m/index.html',
        WXconfig:       {
            swapTitleInWX: true,
            appId: '',
            timestamp:'',
            nonceStr: '',
            signature: ''
        }
    });
});
posted @ 2016-01-22 13:44  黑客PK  阅读(1809)  评论(0编辑  收藏  举报