import QRCode1 from 'qrcodejs2'
shareTo(types) {
//types分享的类型
var title, imageUrl, url, description
//获取文章标题
title = this.kvr.workInfo.name
//获取网页中内容的第一张图片地址作为分享图
imageUrl = this.kvr.workInfo.cover
//获取当前网页url
url = process.env.VUE_APP_TOUR + '/?id=' + this.kvr.workInfo.id
//获取网页描述
description = this.kvr.workInfo.description
if (types == 'qzone') {
window.open('https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + encodeURIComponent(url) + '&sharesource=qzone&title=' + title + '&pics=' + imageUrl + '&summary=' + description)
}
if (types == 'sina') {
window.open('http://service.weibo.com/share/share.php?url=' + encodeURIComponent(url) + '&sharesource=weibo&title=' + title + '&pic=' + imageUrl)
}
if (types == 'wechat') {
if (this.$refs.qrcode) {
this.$refs.qrcode.innerHTML = ''
}
this.wechatShareVisible = true
this.$nextTick(() => {
this.qrcode = new QRCode1(this.$refs.qrcode, {
width: 135,
height: 135,
text: url,
})
})
}
},
PC端分享至QQ空间、新浪、微信
最新推荐文章于 2023-06-29 16:23:50 发布