m-share
Version:
h5页面分享组件、支持分享到微信、朋友圈、qq、QQ空间、QQ好友。
37 lines • 1.56 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>弹窗分享</title>
<script src="../dist/m-share.js"></script>
</head>
<body>
<h1>弹窗分享</h1>
<button style="background: #7bc549;color: #fff;" id="share">点击弹窗</button>
<script>
var config = {
title: 'm-share', // 标题,默认读取document.title
desc: 'm-share的描述', // 描述, 默认读取head标签:<meta name="description" content="desc" />
link: 'http://www.dearhaoge.com/project/m-share/', // 网址,默认使用window.location.href
imgUrl: 'http://www.dearhaoge.com/project/m-share/shareIcon.jpg', // 图片, 默认取网页中第一个img标签
types: ['wx', 'wxline', 'qq', 'qzone', 'sina'], // 开启的分享图标, 默认为全部
infoMap: {
wx: {
title: 'm-share微信分享',
desc: '我是微信的分享',
link: 'http://www.dearhaoge.com/project/m-share/?ADTAG=wx',
imgUrl: 'http://www.dearhaoge.com/project/m-share/shareIcon.jpg'
}
},
fnDoShare: function (type) {
console.log(1);
}
};
document.querySelector('#share').addEventListener('click', function () {
Mshare.popup(config);
});
</script>
</body>
</html>