zoukankan      html  css  js  c++  java
  • 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,最好这两种方法都在页面中使用。

  • 相关阅读:
    鲁迅说过搜索引擎
    下载github上文件与release的安装包-解决s3.amazonaws.com问题
    作业九----DFA最小化
    作业八----非确定的自动机NFA确定化为DFA
    作业七----正规式到正规文法与自动机
    作业六----正规文法与正规式
    第五次作业----词法分析程序的设计与实现
    第四次作业
    作业三
    2.文法和语言
  • 原文地址:https://www.cnblogs.com/deng-jie/p/11532267.html
Copyright © 2011-2022 走看看