目录

$wxshare

提供简单的微信分享能力。

$wxshare.init()

初始化分享能力。

语法

  1. $wxshare.init({
  2. "appid" : "wx853ca6a405d3947d"
  3. });

参数

  • appid:验证分享能力的ID,需在微信开放平台获取

实例

  1. $wxshare.init({
  2. "appid" : "wx853ca6a405d3947d"//appid需要到微信开放平台获取
  3. });

$wxshare.sendText()

分享文字。

语法

  1. $wxshare.sendText({
  2. "type" : "friendsCircle|friend",
  3. "text" : sharedes
  4. })

参数

  • type:分享类型(friend表示分享给好友;friendsCircle表示分享到朋友圈)
  • text:需要分享的文字

实例(分享给朋友)

  1. $wxshare.sendText({
  2. "type" : "friend",
  3. "text" : "分享文字"
  4. })

实例(分享到朋友圈)

  1. $wxshare.sendText({
  2. "type" : "friendsCircle",
  3. "text" : "分享文字"
  4. })

$wxshare.sendTextandImage()

分享文字和图片。

语法

  1. $wxshare.sendTextandImage({
  2. "type" : "friendsCircle|friend",
  3. "url" : "http://mobile.yyuap.com/",
  4. "title" : "图文测试",
  5. "des" : sharedes,
  6. "image" : shareimage
  7. });

参数

  • type:分享类型(friend表示分享给好友;friendsCircle表示分享到朋友圈)
  • url:需要分享的URL
  • title:标题
  • des:需要分享的文字描述
  • image:需要分享的图片

实例(分享给朋友)

  1. $wxshare.sendTextandImage({
  2. "type" : "friend",
  3. "url" : "http://mobile.yyuap.com/",
  4. "title" : "图文测试",
  5. "des" : "分享文字",
  6. "image" : shareimage
  7. });

实例(分享到朋友圈)

  1. $wxshare.sendTextandImage({
  2. "type" : "friendsCircle",
  3. "url" : "http://mobile.yyuap.com/",
  4. "title" : "图文测试",
  5. "des" : "分享文字",
  6. "image" : shareimage
  7. });
文档更新时间: 2018-01-15 14:42