Skip to main content

Share

示例

¥Example

参考

¥Reference

方法

¥Methods

share()

static share(content: ShareContent, options?: ShareOptions);

打开一个对话框来共享文本内容。

¥Open a dialog to share text content.

在 iOS 中,返回一个 Promise,它将用包含 actionactivityType 的对象调用。如果用户关闭对话框,Promise 仍将被解析,操作为 Share.dismissedAction,所有其他键都未定义。请注意,某些共享选项不会在 iOS 模拟器上显示或运行。

¥In iOS, returns a Promise which will be invoked with an object containing action and activityType. If the user dismissed the dialog, the Promise will still be resolved with action being Share.dismissedAction and all the other keys being undefined. Note that some share options will not appear or work on the iOS simulator.

在 Android 中,返回一个 Promise,该 Promise 始终会以 Share.sharedAction 的操作得到解决。

¥In Android, returns a Promise which will always be resolved with action being Share.sharedAction.

属性:

¥Properties:

名称类型描述
内容
必填
objectmessage - 分享一条消息
url - 共享 URL
iOS

title - 消息标题
Android

至少需要 urlmessage 之一。
optionsobjectdialogTitle
Android

excludedActivityTypes
iOS

subject - 通过电子邮件分享的主题
iOS

tintColor
iOS

anchor - 操作表应锚定的节点(用于 iPad)
iOS

属性

¥Properties

sharedAction

static sharedAction: 'sharedAction';

内容已成功分享。

¥The content was successfully shared.


dismissedAction
iOS

static dismissedAction: 'dismissedAction';

该对话框已被取消。

¥The dialog has been dismissed.