let title="需要分享的标题"
let _url = 'https://www.baidu.com/';//自定义网站链接地址
let url = window.location.href;//获取当前网页地址
let content = '自定义内容';//
let sharesinastring=null; //跳转的url地址;
//分享微博。qq qq空间等
toweibo(){
var sharesinastring ='http://service.weibo.com/share/share.php?title=' +
encodeURIComponent(content + '「' + title + '」' + ' 点这里' + url);
window.open(sharesinastring, '_blank');//微博在新页面打开
},
toqq(){
var _shareUrl ='https://connect.qq.com/widget/shareqq/index.html?';
_shareUrl += 'url=' + encodeURIComponent(_url || url);
_shareUrl += '&title=' + encodeURIComponent(title || '自定义');
window.open(_shareUrl, '_blank');//qq
}
toqqkj(){
sharesinastring ='http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?
title=' +encodeURIComponent(title) +
'&desc=' +
encodeURIComponent(content) +
'&summary=' +
encodeURIComponent(content) +
'&url=' +
encodeURIComponent(url);
window.open(sharesinastring, '_blank');//qq空间
}
//下面是一些其他的链接,方法同上
豆瓣: 'http://shuo.douban.com/!service/share?href={{URL}}&name={{TITLE}}&text={{DESCRIPTION}}&image={{IMAGE}}&starid=0&aid=0&style=11',
脸书: 'https://www.facebook.com/sharer/sharer.php?u={{URL}}',
推特: 'https://twitter.com/intent/tweet?text={{TITLE}}&url={{URL}}&via={{ORIGIN}}',
2微信分享需要借助二维码进行分享有两种生成方式qrcode和vue-q-art这里是具体使用方法https://www.cnblogs.com/belongs-to-qinghua/p/12197878.html,