dxy-wechat-share
丁香园前端微信分享组件
使用方法
1. 使用 npm 安装
安装
$ npm install dxy-wechat-share --save
使用
var dxy_wechat_share = require('dxy-wechat-share');
dxy_wechat_share(options);
2. 通过 <script>
直接引用
引用
<script src="jquery.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
<script src="dxy-wechat-share.min.js"></script>
使用
var dxy_wechat_share = require('dxy-wechat-share');
dxy_wechat_share(options);
API
dxy_wechat_share(options);
options
:
-
debug
: Boolean, 启用debug模式, 默认为false
-
title
: String, 分享显示的标题, 默认为页面title
-
desc
: String, 分享显示的描述, 默认为页面title
-
link
: String, 分享链接, 默认为当前链接
-
imgUrl
: String, 分享显示的图片
-
success
: Object, 分享成功回调函数
-
cancel
: Object, 取消分享回调函数
配置
配置信息API: 全局变量 window.wx_share