# showSharePanel ^6.8
打开分享界面(Promise返回),微信,朋友圈,qq或者更多
# 请求参数
Prop | Type | Default | Comment |
---|---|---|---|
link | String | N/A | 分享链接 |
imgUrl | String | N/A | 分享图标 |
pic | String | N/A | 分享图标-- 安卓特有 8.1后生效 |
desc | String | N/A | 分享描述 |
title | String | N/A | 分享标题 |
dataUrl | String | N/A | 如果type是music或video, 则要提供数据链接,默认为空 |
customShareList | Array | N/A | 自定义分享类型 |
shareBlackList | Array | N/A | 黑名单列表,在黑名单内不显示,取值有wx,wxTimeLine,qq,qzone,weibo |
customShareList的props
Prop | Type | Default | Comment |
---|---|---|---|
label | String | N/A | 自定义分享按钮名字 |
iconUrl | String | N/A | icon的链接 |
tag | String | N/A | 自定义的标签,用于event回调的标识eventName |
# 接口调用示例
const params = {
title: 'hello world', // 分享标题
desc: 'i love this world', // 分享描述
link: '', // 分享链接
imgUrl: '', // 分享图标
pic: '', // 分享图标 安卓特有 v8.1
dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
customShareList: [
{
label: '抖音', // '自定义分享按钮名字,',
iconUrl: 'https://midea-images.mideav.com/meiju/yunMute0.png',
tag: 'douyin',
},
], //自定义扩展分享按钮,
shareBlackList: [], //黑名单列表,在黑名单内不显示,取值有wx,wxTimeLine,qq,qzone,weibo
}
this.$bridge
.showSharePanel(params)
.then(res => {
this.$alert(res)
})
.catch(err => {
this.$toast(err)
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 非自定义的返回参数
- 成功时返回
Prop | Type | Default | Description |
---|---|---|---|
shareType | String | N/A | 分享类型,//weibo,wx,wxTimeline,qq,qzone,refresh,copyUrl,openUrl, cancel(shareType为空或cancel为取消分享) |
errorCode | Number | N/A | 0 操作成功 |
- 失败时返回
Prop | Type | Default | Description |
---|---|---|---|
errorMessage | String | N/A | 错误消息 |
errorCode | Number | N/A | 错误码 |
# 自定义分享按钮的点击回调通过event传输,
globalEvent("receiveMessageFromApp") 通知H5页面,返回的数据为
this.$bridge.addEventListener('receiveMessageFromApp', (res) => {
if (res.messageType == 'extendShareItemClick') {
// { messageType: "loginResult", messageBody: {status:0} } //0:成功登录
console.log('mainjs....receiveMessageFromApp..........', res)
}
//res为如下:
/*
{
messageType: 'extendShareItemClick', //消息类型,H5通过这个类型判断是否获取数据
messageBody: {"itemTag":"xxx"} //菜单按钮的唯一标识 等于入参中的 customShareList.tag的值
}
*/
})
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13