# shareCustomPanel ^6.8
自定义分享
# 请求参数
| Prop | Type | Default | Comment | 
|---|---|---|---|
imgBase64 |  String |  N/A |  分享的图片base64 | 
liteInfo |  Object |  N/A |  (^6.3.0) 小程序的分享信息,不为空时表示以小程序的形式分享到微信好友,不需要以小程序形式此字段可以不传 | 
link |  String |  N/A |  分享的跳转链接 | 
imgPopupUrl |  String |  N/A |  分享弹窗中显示的图片链接 | 
title |  String |  N/A |  分享的标题 | 
imgPopupBase64 |  String |  N/A |  分享弹窗中显示的图片base64,有imgPopupUrl优先显示imgPopupUrl | 
weiboDesc |  String |  N/A |  (^6.3.0)分享到微博的描述,为空时取desc,字段可以不传 | 
types |  Array |  N/A |  分享类型数组,wx表示微信分享,qq表示qq分享,sms表示短信分享,weibo表示新浪微博,qzone表示QQ空间,wxTimeline表示微信朋友圈 | 
imgUrl |  String |  N/A |  分享的图片链接 | 
desc |  String |  N/A |  分享的文本内容 | 
extendList |  Array |  N/A |  (^6.3.0)3种扩展类型 "copy","openBrowser","refresh",6.7.0扩展 ”QRCode","report","imgSaveAs" | 
type |  String |  N/A |  (^6.3.0):“web”图文 “image”图片,不传默认为图文 。当为img时,imgUrl为分享的图片链接或者imgBase64 | 
- liteInfo 对象属性
 
| Prop | Type | Default | Comment | 
|---|---|---|---|
userName |  String |  N/A |  小程序ID | 
imgUrl |  String |  N/A |  分享的封面图链接,图片大小不超过128K | 
title |  String |  N/A |  分享的引导语 | 
path |  String |  N/A |  分享的跳转小程序链接 | 
webpageUrl |  String |  N/A |  H5链接,无法以小程序形式分享时,默认以H5链接形式分享 | 
miniprogramType |  String |  N/A |  (^8.7.0):小程序类型   1、WXMiniProgramTypePreview :预览版(体验)  2、WXMiniProgramTypeTest (开发)测试版  3  WXMiniProgramTypeRelease (生产)正式版 备注:miniprogramType和userName一定要匹配正确。生产环境一定是正式版本,测试环境传递什么版本就是什么版本小程序,如果不传该参数,app包关闭了日志打印功能,比如 ios 发布  | 
# 接口调用示例
const params = {
  types: ['wx'], //分享类型数组,wx表示微信分享,qq表示qq分享,sms表示短信分享,weibo表示新浪微博,qzone表示QQ空间,wxTimeline表示微信朋友圈,
  extendList: ['copy'], //(^6.3.0)3种扩展类型 "copy","openBrowser","refresh",6.7.0扩展 ”QRCode","report","imgSaveAs"
  title: 'baidu', //分享的标题
  desc: 'baidu_home_page', //分享的文本内容
  imgUrl: 'wwww.baidu.com', //分享的图片链接
  imgBase64: 'xxxxxx', //分享的图片base64
  link: 'www.hao123.com', //分享的跳转链接
  weiboDesc: 'xxxxx', // (^6.3.0)分享到微博的描述,为空时取desc,字段可以不传
  liteInfo: {
    //(^6.3.0) 小程序的分享信息,不为空时表示以小程序的形式分享到微信好友,不需要以小程序形式此字段可以不传
    webpageUrl: 'xxxxxx', //H5链接,无法以小程序形式分享时,默认以H5链接形式分享
    path: 'xxxxxx', //分享的跳转小程序链接
    userName: 'gh_bf92931b2bd6', //小程序ID
    title: 'xxxxxx', //分享的引导语
    imgUrl: 'xxxx', //分享的封面图链接,图片大小不超过128K
    miniprogramType: 'WXMiniProgramTypeRelease' // 
  },
  imgPopupUrl: 'xxxxxx', //分享弹窗中显示的图片链接
  imgPopupBase64: 'xxxxxx', //分享弹窗中显示的图片base64,有imgPopupUrl优先显示imgPopupUrl
  type: 'web', //(^6.3.0):“web”图文 “image”图片,不传默认为图文 。当为img时,imgUrl为分享的图片链接或者imgBase64。
}
this.$bridge
  .shareCustomPanel(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
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 返回参数
- 成功时返回
 
| Prop | Type | Default | Description | 
|---|---|---|---|
errorCode |  String |  N/A |  0 分享成功, 1 取消分享 | 
shareType |  String |  N/A |  点击的类型 wx表示微信分享, qq表示qq分享,sms表示短信分享,weibo表示新浪微博, qzone表示QQ空间,wxTimeline表示微信朋友圈,copy表示复制链接",openBrowser表示打开浏览器,refresh表示刷新,QRCode标识点击二维码,report标识举报,imgSaveAs保存图片 | 
- 失败时返回
 
| Prop | Type | Default | Description | 
|---|---|---|---|
errorCode |  Number |  N/A |  错误码 | 
errorMessage |  String |  N/A |  错误消息 |