m-share
Version:
h5页面分享组件、支持分享到微信、朋友圈、qq、QQ空间、QQ好友。
35 lines • 1.43 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>
<div id="myDom"></div>
<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);
}
};
Mshare.render('#myDom', config);
</script>
</body>
</html>