ClipboardEvent()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2018年4月.
ClipboardEvent() 构造函数返回一个新建的 ClipboardEvent 对象,这个对象表示与修改剪切板相关的事件,这些事件包括 cut 、 copy 和 paste 事件。
语法
js
new ClipboardEvent(type)
new ClipboardEvent(type, options)
参数
ClipboardEvent() 构造函数也从 Event() 继承参数。
- type
-
一个
DOMString字符串,描述了ClipboardEvent事件类型的名字,大小写敏感,可以是:'copy'、'cut'或者'paste'。 - options 可选
-
选项如下:
clipboardData: 一个DataTransfercontaining the data concerned by the clipboard event.dataType非标准 : ADOMStringcontaining the MIME-type of the data contained in thedataargument.data非标准 : ADOMStringcontaining the data concerned by the clipboard event.
规范
| Specification |
|---|
| Clipboard API and events> # dom-clipboardevent-clipboardevent> |
浏览器兼容性
参见
- 与复制相关的事件:
copy,cut,paste - 所属的
ClipboardEvent接口。