# shareMsg ^6.8
分享功能,直接触发分享(微信,QQ,微博等
# 请求参数
Prop | Type | Default | Comment |
---|---|---|---|
type | String | N/A | 分享类型,wx表示微信分享,qq表示qq分享,sms表示短信分享,weibo表示新浪微博,qzone表示QQ空间,wxTimeline表示微信朋友圈 |
title | String | N/A | 分享的标题 |
msgType | String | N/A | (^5.10.0):“web”图文 “img”图片,不传默认为图文 。当为img时,imgUrl为分享的图片链接。 |
desc | String | N/A | 分享的文本内容 |
link | String | N/A | 分享的跳转链接 |
imgUrl | String | N/A | 分享的图片链接 |
# 接口调用示例
const params = {
type: 'wx', //分享类型,wx表示微信分享,qq表示qq分享,sms表示短信分享,weibo表示新浪微博,qzone表示QQ空间,wxTimeline表示微信朋友圈
title: 'title1', //分享的标题
desc: 'desc1', //分享的文本内容
imgUrl:'http://baidu.com/pic', //分享的图片链接
link: 'http://baidu.com', //分享的跳转链接
msgType: 'web', //(^5.10.0):“web”图文 “img”图片,不传默认为图文 。当为img时,imgUrl为分享的图片链接。
}
this.$bridge
.shareMsg(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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 返回参数
- 成功时返回
Prop | Type | Default | Description |
---|---|---|---|
errorCode | Number | N/A | |
shareType | String | N/A | 分享类型,weibo,wx,wxTimeline,qq,qzone,image,sms |
- 失败时返回
Prop | Type | Default | Description |
---|---|---|---|
errorCode | Number | N/A | 错误码 |
errorMsg | String | N/A | 错误消息 |