JavaScript/drag:修订间差异
来自康健生活
创建页面,内容为“== 标题文字 == == e.dataTransfer == 在做拖拽的时候,我在 <code>onDragStart</code> 阶段使用 <syntaxhighlight lang="javascript"> _.dataTransfer.setD…” |
|||
| 第18行: | 第18行: | ||
随后查阅,有人的解释是说 dataTransfer 的存储机制是在专为 drag 设置的数据存储 stroe 有读取限制,根据 [https://www.w3.org/html/wg/spec/dnd.html#the-dragevent-and-datatransfer-interfaces 7.7 The DragEvent and DataTransfer interfaces -> the-drag-data-store]<ref>HTML5 A vocabulary and associated APIs for HTML and XHTML Editor's Draft 25 October 2010</ref> | 随后查阅,有人的解释是说 dataTransfer 的存储机制是在专为 drag 设置的数据存储 stroe 有读取限制,根据 [https://www.w3.org/html/wg/spec/dnd.html#the-dragevent-and-datatransfer-interfaces 7.7 The DragEvent and DataTransfer interfaces -> the-drag-data-store]<ref>HTML5 A vocabulary and associated APIs for HTML and XHTML Editor's Draft 25 October 2010</ref> | ||
<pre> | |||
The information in a drag data store used to generate the UI feedback during the drag consists of: | |||
A list of zero or more elements. | |||
Optionally, a bitmap image and the coordinate of a point within that image. | |||
A drag data store is created at the start of a drag-and-drop operation in the read/write mode, and then progresses through the following three modes as the operation proceeds: | |||
Read/write mode | |||
At the start of the drag. New data can be added to the drag data store. | |||
Protected mode | |||
During the drag. The formats and kinds in the drag data store list of items representing dragged data can be enumerated, but the data itself is unavailable and no new data can be added. | |||
Read-only mode | |||
After the drop. The list of items representing dragged data can be read, including the data. No new data can be added.</pre> | |||
2022年4月1日 (五) 04:33的版本
标题文字
e.dataTransfer
在做拖拽的时候,我在 onDragStart 阶段使用
_.dataTransfer.setData(format, {
'id': _.target?.id || _.target?.getAttribute('data-id'),
format,
'class': className,
'listClass': format === 'group'
? 'groupArtboardList'
: void 0
});
设置一些参数,以期待在 onDragOver 阶段拿出来使用,但实际取出来的却是空值。
模板:Leftrightflex
随后查阅,有人的解释是说 dataTransfer 的存储机制是在专为 drag 设置的数据存储 stroe 有读取限制,根据 7.7 The DragEvent and DataTransfer interfaces -> the-drag-data-store[1]
The information in a drag data store used to generate the UI feedback during the drag consists of: A list of zero or more elements. Optionally, a bitmap image and the coordinate of a point within that image. A drag data store is created at the start of a drag-and-drop operation in the read/write mode, and then progresses through the following three modes as the operation proceeds: Read/write mode At the start of the drag. New data can be added to the drag data store. Protected mode During the drag. The formats and kinds in the drag data store list of items representing dragged data can be enumerated, but the data itself is unavailable and no new data can be added. Read-only mode After the drop. The list of items representing dragged data can be read, including the data. No new data can be added.
- ↑ HTML5 A vocabulary and associated APIs for HTML and XHTML Editor's Draft 25 October 2010
No categories