aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/window/copy_event/index.html
blob: b2797de03e9e8bed289b46aef80b75b12829e746 (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
69
70
71
72
---
title: 'Window: copy event'
slug: Web/API/Window/copy_event
tags:
  - API
  - Clippboard API
  - copy
translation_of: Web/API/Window/copy_event
---
<div>{{APIRef}}</div>

<p><span class="seoSummary">当用户通过浏览器的用户界面启动复制操作时,将触发 <strong><code>copy</code></strong> 事件。</span></p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">Bubbles(支持冒泡)</th>
   <td>Yes</td>
  </tr>
  <tr>
   <th scope="row">Cancelable(可撤销)</th>
   <td>Yes</td>
  </tr>
  <tr>
   <th scope="row">Interface(接口)</th>
   <td>{{domxref("ClipboardEvent")}}</td>
  </tr>
  <tr>
   <th scope="row">Event handler property(事件处理程序属性)</th>
   <td>{{domxref("HTMLElement/oncopy", "oncopy")}}</td>
  </tr>
 </tbody>
</table>

<p>此事件的原始目标是 {{domxref("Element")}} 它是复制操作的预期目标。您可以在 {{domxref("Window")}} 界面上监听此事件,以在捕获或冒泡阶段对其进行处理。 有关此事件的完整详细信息,请参见 <a href="/en-US/docs/Web/API/Element/copy_event">Element: copy event</a>.</p>

<h2 id="示例">示例</h2>

<pre class="brush: js">window.addEventListener('copy', (event) =&gt; {
    console.log('copy action initiated')
});</pre>

<h2 id="规范">规范</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">规范</th>
   <th scope="col">状态</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('Clipboard API', '#clipboard-event-copy')}}</td>
   <td>{{Spec2('Clipboard API')}}</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>



<p>{{Compat("api.Window.copy_event")}}</p>

<h2 id="参考">参考</h2>

<ul>
 <li>相关联事件:{{domxref("Window/cut_event", "cut")}}, {{domxref("Window/paste_event", "paste")}}</li>
 <li>{{domxref("Element")}} 目标上的这个事件: {{domxref("Element/copy_event", "copy")}}</li>
 <li>{{domxref("Document")}} 目标上的这个事件: {{domxref("Document/copy_event", "copy")}}</li>
</ul>