• QQ的二次分享


     

    方法一:
    QQ分享会直接取页面中的meta中的值,注意meta的写法和属性 //页面头部写上以下meta标签 <meta name="title" content="今年双十二应该不会像去年那样惨?"> <meta itemprop="name" content="今年双十二应该不会像去年那样惨?"> <meta name="description" itemprop="description" content="张译文的观点"> <meta itemprop="image" name="image" src="http://zmall.hazq.com:8295/m/tgwd/images/huiying.png" content="http://zmall.hazq.com:8295/m/tgwd/images/huiying.png"> //页面刚开始位置写上一个隐藏的img标签,路径和分享出去的图片一致,避免qq分享直接取页面第一张图片 <div class="share" style="display:none;"> <img src="http://soft.thinkive.com/h5/huaanzx/news/images/weiyapp.png"> </div> 注:如果你的页面分享出去的数据是动态的,那么content需要随便写上一个值然后再重新赋值,不能默认为空,不然重新赋值不起作用 $("meta[name='description']").attr('content',opinionParam.employeename+"的观点"); $("meta[name='title']").attr('content',opinionParam.title); $("title").html(opinionParam.title); $("meta[itemprop='name']").attr('content',opinionParam.title);
    $("meta[name='image']").attr('src',"http://zmall.hazq.com:8295/m/tgwd/images/huiying.png");
    $("meta[name='image']").attr('content',"http://zmall.hazq.com:8295/m/tgwd/images/huiying.png");

      

    方法二:使用QQ的sdk
    <script type="text/javascript" src="//open.mobile.qq.com/sdk/qqapi.js?_bid=152"></script>
    //QQ的二次分享
        function qqShare(){
    	var pageURL = 'http://soft.thinkive.com/h5/huaanzx/tgwd/index.html#!/personalStore/opinionDetail.html?opinion_id=93';
        	  mqq.data.setShareInfo({
    		title:opinionParam.title, // 分享标题
    		desc :opinionParam.employeename+"的观点", // 分享内容
    		image_url :"http://zmall.hazq.com:8295/m/tgwd/images/huiying.png", // 分享图片
    		share_url:pageURL, // 分享链接
    	},function(){});
        }
    

      注:为了适应安卓和ios,最好这两种方法都在页面中使用。

  • 相关阅读:
    git pull 的时候 把本地的修改 覆盖远程端
    git 把其他分支上的文件拿来覆盖本地
    JS高德地图计算两地之间的实际距离
    C# 微信开发-----微信会员卡(三)激活会员卡
    C# 微信开发-----微信会员卡(二)
    Jquery点击div之外的地方隐藏当前div
    css好看的银行卡号样式
    C# 微信开发-----微信会员卡(一)
    Js操作Array数组
    好看的404代码
  • 原文地址:https://www.cnblogs.com/deng-jie/p/11532267.html
Copyright © 2020-2023  润新知