blob: 1ffb99b9e7fec48504446c0dc8269018ae5103d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
---
title: DataTransferItemList
slug: Web/API/DataTransferItemList
translation_of: Web/API/DataTransferItemList
---
<p>{{APIRef("HTML Drag and Drop API")}}</p>
<p><code><strong>DataTransferItemList</strong></code> 对象是一组代表被拖动项的{{domxref("DataTransferItem")}} 对象的列表。在拖动操作期间,每个{{domxref("DragEvent")}} 都有一个 {{domxref("DragEvent.dataTransfer","dataTransfer")}} 属性,该属性是 <code>DataTransferItemList</code>.</p>
<p>该接口没有构造函数</p>
<h2 id="属性">属性</h2>
<dl>
<dt>{{domxref("DataTransferItemList.length")}} {{readonlyInline}}</dt>
<dd> <code>无符号长整型</code> :列表中拖动项的数量。</dd>
</dl>
<h2 id="方法">方法</h2>
<dl>
<dt>{{domxref("DataTransferItemList.add()")}}</dt>
<dd>向拖动项列表中添加新项 ({{domxref("File")}}对象或{{domxref("DOMString","string")}}),该方法返回一个 {{domxref("DataTransferItem")}} 对象。</dd>
<dt>{{domxref("DataTransferItemList.remove()")}}</dt>
<dd>根据索引删除拖动项列表中的对象。</dd>
<dt>{{domxref("DataTransferItemList.clear()")}}</dt>
<dd>清空拖动项列表。</dd>
<dt>{{domxref("DataTransferItemList.DataTransferItem()")}}</dt>
<dd>取值方法:返回给定下标的{{domxref("DataTransferItem")}}对象.</dd>
</dl>
<h2 id="示例">示例</h2>
<p>每个方法或属性都有其引用页面,每一个引用页对应也有使用示例。</p>
<h2 id="规范">规范</h2>
<table>
<tbody>
<tr>
<th scope="col">规范</th>
<th scope="col">状态</th>
<th scope="col">备注</th>
</tr>
<tr>
<td>{{SpecName('HTML WHATWG', 'interaction.html#datatransferitemlist','DataTransferItemList')}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td></td>
</tr>
<tr>
<td>{{SpecName('HTML5.1', 'editing.html#datatransferitemlist','DataTransferItemList')}}</td>
<td>{{Spec2('HTML5.1')}}</td>
<td>Not included in W3C HTML5 {{Spec2('HTML5 W3C')}}</td>
</tr>
<tr>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<div class="hidden">
<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
</div>
<p>{{Compat("api.DataTransferItemList")}}</p>
|