aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/datatransferitem/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/datatransferitem/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/datatransferitem/index.html')
-rw-r--r--files/zh-cn/web/api/datatransferitem/index.html121
1 files changed, 121 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/datatransferitem/index.html b/files/zh-cn/web/api/datatransferitem/index.html
new file mode 100644
index 0000000000..1f05ea0fb9
--- /dev/null
+++ b/files/zh-cn/web/api/datatransferitem/index.html
@@ -0,0 +1,121 @@
+---
+title: DataTransferItem
+slug: Web/API/DataTransferItem
+translation_of: Web/API/DataTransferItem
+---
+<div>{{APIRef("HTML Drag and Drop API")}}</div>
+
+<p><code><strong>DataTransferItem</strong></code> 描述了一个拖拽项。在一个拖拽操作<em>中,</em>每一个 {{domxref("DragEvent","drag event")}} 都有一个{{domxref("DragEvent.dataTransfer","dataTransfer")}} 属性,它包含一个存有拖拽数据的 {{domxref("DataTransferItemList","list")}} ,其中每一项都是一个 <code>DataTransferItem</code> 。</p>
+
+<p>这个接口没有构造函数。</p>
+
+<h2 id="属性">属性</h2>
+
+<dl>
+ <dt>{{domxref("DataTransferItem.kind")}} {{readonlyInline}}</dt>
+ <dd>拖拽项的种类,<code>string</code> 或是 <code>file。</code></dd>
+ <dt>{{domxref("DataTransferItem.type")}} {{readonlyInline}}</dt>
+ <dd>拖拽项的类型,一般是一个MIME 类型.</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{domxref("DataTransferItem.getAsFile()")}}</dt>
+ <dd>返回一个关联拖拽项的 {{domxref("File")}} 对象 (当拖拽项不是一个文件时返回 null)。</dd>
+ <dt>{{domxref("DataTransferItem.getAsString()")}}</dt>
+ <dd>使用拖拽项的字符串作为参数执行指定回调函数。</dd>
+ <dt>{{domxref("DataTransferItem.webkitGetAsEntry()")}} {{Non-standard_inline}}</dt>
+ <dd>返回一个基于 {{domxref("FileSystemEntry")}} 的对象来表示文件系统中选中的项目。通常是返回一个{{domxref("FileSystemFileEntry")}} 或是 {{domxref("FileSystemDirectoryEntry")}} 对象.</dd>
+</dl>
+
+<h2 id="例子">例子</h2>
+
+<p>这个接口所有的属性和方法都有自己的介绍页,请到各自的介绍页中查看示例用法。</p>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', 'interaction.html#datatransferitem','DataTransferItem')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td>初始定义</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML5.1', 'editing.html#datatransferitem','DataTransferItem')}}</td>
+ <td>{{Spec2('HTML5.1')}}</td>
+ <td>W3C snapshot of WHATWG</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('File System API', '#dom-datatransferitem-webkitgetasentry', 'DataTransferItem.webkitGetAsEntry()')}}</td>
+ <td>{{Spec2('File System API')}}</td>
+ <td><a href="/en-US/docs/Web/API/File_and_Directory_Entries_API">File and Directory Entries API</a> 中定义了<code>webkitGetAsEntry()</code></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>4</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop(50)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>12</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Android Webview</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>Firefox OS</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile(50)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>