ok.shareAppMessage(Object object)

从客户端分享消息至微信、微博、易信等社交平台。

参数

Object object

属性 类型 默认值 必填 说明
title string 是 分享主题
desc string 是 分享描述
link string 是 分享链接
imgUrl string 是 分享图标
type string 'link' 否 分享类型
dataUrl string 否 当type值是music或video时,则要提供数据链接
toClient array. 否 分享至的社交平台列表,由客户端提供选择框供用户选择。当数组只有一个值,则直接分享到客户端,如['wechat'],代表直接分享到微信;当大于1时,如['wechat']则,仅仅弹出微信与微信朋友圈的选择分享框

object.type 的合法值

属性 类型 说明
music string 音乐
video string 视频
link string 链接

object.toClient 的合法值

属性 类型 说明
wechat string 微信

示例代码

ok.shareAppMessage({
title: '邀你抢先体验天翼云盘免费会员!',
desc: '享4T个人云空间+2T家庭云空间,及高速传输等8大特权!',
link: 'https://m.cloud.189.cn/zhuanti/2018/limitfree/index.html',
imgUrl: 'https://m.cloud.189.cn/zhuanti/2018/limitfree/img/share_weixin.jpg', // 分享图标
type: '',
dataUrl: '',
toClient: ['wechat']
})
.catch(err => {
console.log('设置分享信息错误',err);
});
  1. 1. ok.shareAppMessage(Object object)
    1. 1.1. 参数
      1. 1.1.1. object.type 的合法值
      2. 1.1.2. object.toClient 的合法值
    2. 1.2. 示例代码