当用户通过浏览器的用户界面启动复制操作时,将触发 copy
事件。
Bubbles(支持冒泡) | Yes |
---|---|
Cancelable(可撤销) | Yes |
Interface(接口) | ClipboardEvent |
Event handler property(事件处理程序属性) | oncopy |
此事件的原始目标是 Element
它是复制操作的预期目标。您可以在 Window
界面上监听此事件,以在捕获或冒泡阶段对其进行处理。 有关此事件的完整详细信息,请参见 Element: copy event.
示例
window.addEventListener('copy', (event) => {
console.log('copy action initiated')
});
规范
规范 | 状态 |
---|---|
Clipboard API and events | Working Draft |
浏览器兼容性
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.