0.1.5 • Published 4 years ago

@xingway/wechat-share v0.1.5

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

微信分享

简单,不依赖第三方库,支持jsonp跨域。

使用

  1. 引入
//页面引入
<script src="dist/wechat.share.js"></script>

//npm引入
npm i @xingway/wechat-share -S
  1. 初始化对象
const ws = new WechatShare(config)

参数

config: {
  apiURL: '', // 分享接口服务器地址
  wxURL: '//res.wx.qq.com/open/js/jweixin-1.4.0.js', //JSAPI地址
  debug: false, 调试模式
  type: 'post', //请求类型
  jsonp: true, //jsonp跨域
  data: {
    link: location.href, //分享链接
    title: '', //分享title
    desc: '', //分享文案
    imgUrl: '', //分享图片
    success: null, //成功回调
    cancel: null, //取消回调
    fail: null, //失败回调
    complete: null //完成回调
   }
}

方法

ws.shareToFriend(data) //单独设置分享朋友数据
ws.shareToTimeline(data) //单独设置分享朋友圈数据
ws.shareToWeibo(data) //单独设置分享微博数据
0.1.5

4 years ago

0.1.4

4 years ago

0.1.2

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

1.0.0

4 years ago