uniapp分享转发功能实现
[需要先下载插件:地址附上](https://ext.dcloud.net.cn/plugin?id=4860#detail)
[333](https://ext.dcloud.net.cn/plugin?id=4860#detail)
/* 分享 目录为 uni_moudules/uni-share */
uniShare() {
uniShare.show({
content: { //公共的分享参数配置 类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
type: 0,
href: 'https://www.chebaba.com/car?SMARTCODE=K2021-50183-5302-138-124011-39101187&bd_vid=9336453569660387966&mz_ca=2236419&mz_sp=7sO8j&mz_kw=39917169',
title: '预约试驾',
summary: '车型选择',
imageUrl: '/static/test-drive/share/logo.jpg'
},
menus: [{
"img": "/static/test-drive/share/weixin.png",
"text": "微信好友",
"share": { //当前项的分享参数配置。可覆盖公共的配置如下:分享到微信小程序,配置了type=5
"provider": "weixin",
"scene": "WXSceneSession"
}
},
{
"img": "/static/test-drive/share/pyq.png",
"text": "微信朋友圈",
"share": {
"provider": "weixin",
"scene": "WXSceneTimeline"
}
},
{
"img": "/static/test-drive/share/xiaochengxu.png",
"text": "微信小程序",
"share": {
provider: "weixin",
scene: "WXSceneSession",
type: 5,
miniProgram: {
id: '123',
path: '/pages/list/detail',
webUrl: '/#/pages/list/detail',
type: 0
},
}
},
{
"img": "/static/test-drive/share/weibo.png",
"text": "微博",
"share": {
"provider": "sinaweibo"
}
},
{
"img": "/static/test-drive/share/QQ.png",
"text": "QQ",
"share": {
"provider": "qq"
}
},
{
"img": "/static/test-drive/share/fuzhi.png",
"text": "复制",
"share": "copyurl"
},
{
"img": "/static/test-drive/share/gengduo.png",
"text": "更多",
"share": "shareSystem"
}
],
cancelText: "取消分享",
}, e => { //callback
console.log(uniShare.isShow);
console.log(e);
})
},