DataTransferItem - Web APIs 编辑

The DataTransferItem object represents one drag data item. During a drag operation, each drag event has a dataTransfer property which contains a list of drag data items. Each item in the list is a DataTransferItem object.

This interface has no constructor.

Properties

DataTransferItem.kind Read only
The kind of drag data item, string or file.
DataTransferItem.type Read only
The drag data item's type, typically a MIME type.

Methods

DataTransferItem.getAsFile()
Returns the File object associated with the drag data item (or null if the drag item is not a file).
DataTransferItem.getAsFileSystemHandle()
Returns a FileSystemFileHandle if the dragged item is a file, or a FileSystemDirectoryHandle if the dragged item is a directory.
DataTransferItem.getAsString()
Invokes the specified callback with the drag data item string as its argument.
DataTransferItem.webkitGetAsEntry() This API has not been standardized.
Returns an object based on FileSystemEntry representing the selected file's entry in its file system. This will generally be either a FileSystemFileEntry or FileSystemDirectoryEntry object.

Example

All of this interface's methods and properties have their own reference page, and each reference page has an example of its usage.

Specifications

SpecificationStatusComment
HTML Living Standard
The definition of 'DataTransferItem' in that specification.
Living StandardInitial definition.
HTML 5.1
The definition of 'DataTransferItem' in that specification.
RecommendationW3C snapshot of WHATWG
File and Directory Entries API
The definition of 'DataTransferItem.webkitGetAsEntry()' in that specification.
DraftDefinition of webkitGetAsEntry() as part of the File and Directory Entries API.

Browser compatibility

BCD tables only load in the browser

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:111 次

字数:4769

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文