Web 分享功能
为游戏集成需要支持社交功能的第三方渠道后,根据 Share 的说明实现分享功能。
Facebook
使用 share 函数分享内容到 Facebook。
accountApi.share({
third_type: 'facebook',
href: '',
hashtag: '#facebook share demo',
app_id: 'xxxxx',
display: 'popup',
})
参数说明:
| 参数 | 类型 | 说明 | 是否必填 |
|---|---|---|---|
| third_type | string | 第三方渠道类型 facebook | 必填 |
| app_id | string | Facebook 应用的唯一标识符 | 必填 |
| href | string | 附加到此帖子的链接 | 必填 |
| display | string | 对话框呈现方式:page、iframe、popup、touch更多信息参见 分享对话框 | 选填 |
| redirect_uri | string | 用户点击对话框按钮后重定向的网址 | 选填 |
Kakao
使用 share 函数分享内容到 Kakao Story 或 Kakao Talk。
accountApi.share({
third_type: 'kakao',
shareType: '',
jsKey: '',
href: '',
text: '',
imageUrl: '',
title: '',
description: ''
})
参数说明:
| 参数 | 类型 | 说明 | 是否必填 |
|---|---|---|---|
| third_type | string | 第三方渠道类型 kakao | 必填 |
| shareType | string | 分享类型:story - Kakao Storytalk - Kakao Talk | 必填 |
| jsKey | string | Kakao JavaScript Key | 必填 |
| href | string | 分享页面 URL 当 shareType 为 story 时,可设置背景图片和标题 | 必填 |
| text | string | 自动输入的文字 不需要默认文字时可设置为空字符串 '' | story 类型必填 |
| imageUrl | string | 分享页面背景图片 URL | talk 类型必填 |
| title | string | 分享页面标题 | talk 类型必填 |
| description | string | 分享页面描述 | talk 类型选填 |
X
使用 share 函数分享内容到 X
accountApi.share({
third_type: 'twitter',
url: '',
text: '',
hashtag: '#twitter share demo',
})
参数说明:
| 参数 | 类型 | 说明 | 是否必填 |
|---|---|---|---|
| third_type | string | 第三方渠道类型 twitter | 必填 |
| url | string | 共享 URL,将在推文中自动缩短 共享 URL 可能会显示为卡片 | 选填 |
| via | string | 使用 via 参数标记用户 (@username) | 选填 |
| text | string | 预填充到推文编辑器的文本 用户可轻松删除 | 选填 |
| hashtags | string | 逗号分隔的主题标签列表 | 选填 |
VK
使用 share 函数分享内容到 VK。
accountApi.share({
third_type: 'vk',
url: '',
image: '',
title: 'vk share demo',
})
参数说明:
| 参数 | 类型 | 说明 | 是否必填 |
|---|---|---|---|
| third_type | string | 第三方渠道类型 vk | 必填 |
| url | string | 分享链接 | 必填 |
| image | string | 图片地址 | 选填 |
| title | string | 标题 | 选填 |