-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(cn): translate content/docs/reference-events.md into Chinese #101
Conversation
Deploy preview for cn-reactjs ready! Built with commit ae22e81 |
content/docs/reference-events.md
Outdated
@@ -52,23 +49,23 @@ function onClick(event) { | |||
console.log(eventType); // => "click" | |||
}, 0); | |||
|
|||
// Won't work. this.state.clickEvent will only contain null values. | |||
// 无用,this.state.clickEvent 会只包含 null 值 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 无用,this.state.clickEvent 会只包含 null 值 | |
// 不起作用,this.state.clickEvent 的值将会只包含 null |
已修改 |
content/docs/reference-events.md
Outdated
|
||
## Overview {#overview} | ||
## 概述 {#overview} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## 概述 {#overview} | |
## 概览 {#overview} |
FYI: #2
content/docs/reference-events.md
Outdated
@@ -6,13 +6,13 @@ layout: docs | |||
category: Reference | |||
--- | |||
|
|||
This reference guide documents the `SyntheticEvent` wrapper that forms part of React's Event System. See the [Handling Events](/docs/handling-events.html) guide to learn more. | |||
此参考指南记录了构成 React 事件系统一部分的 `SyntheticEvent` 包装器。参考 [Handling Events](/docs/handling-events.html) 指南学习更多。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此参考指南记录了构成 React 事件系统一部分的 `SyntheticEvent` 包装器。参考 [Handling Events](/docs/handling-events.html) 指南学习更多。 | |
此参考指南记录了构成 React 事件系统一部分的 `SyntheticEvent` 包装器。请参考有关[事件处理](/docs/handling-events.html)的指南来了解更多。 |
@@ -6,13 +6,13 @@ layout: docs | |||
category: Reference | |||
--- | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
标题翻译为 合成事件 ?
content/docs/reference-events.md
Outdated
|
||
Your event handlers will be passed instances of `SyntheticEvent`, a cross-browser wrapper around the browser's native event. It has the same interface as the browser's native event, including `stopPropagation()` and `preventDefault()`, except the events work identically across all browsers. | ||
`SyntheticEvent` 实例将被传递给你的事件处理程序,这是一个浏览器原生事件的跨浏览器包装器。除了在所有浏览器间完全相同的事件,它有着和浏览器原生事件相同的接口,包括 `stopPropagation()` 和 `preventDefault()` 。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`SyntheticEvent` 实例将被传递给你的事件处理程序,这是一个浏览器原生事件的跨浏览器包装器。除了在所有浏览器间完全相同的事件,它有着和浏览器原生事件相同的接口,包括 `stopPropagation()` 和 `preventDefault()` 。 | |
`SyntheticEvent` 实例将被传递给你的事件处理函数,它是浏览器的原生事件的跨浏览器包装器。除兼容所有浏览器外,它还拥有和浏览器原生事件相同的接口,包括 `stopPropagation()` 和 `preventDefault()`。 |
content/docs/reference-events.md
Outdated
|
||
If you find that you need the underlying browser event for some reason, simply use the `nativeEvent` attribute to get it. Every `SyntheticEvent` object has the following attributes: | ||
如果因为某些原因,你需要使用浏览器的底层事件,只需要使用 `nativeEvent` 属性实现。每个 `SyntheticEvent` 对象有以下属性: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果因为某些原因,你需要使用浏览器的底层事件,只需要使用 `nativeEvent` 属性实现。每个 `SyntheticEvent` 对象有以下属性: | |
当你需要使用浏览器的底层事件时,只需要使用 `nativeEvent` 属性来获取即可。每个 `SyntheticEvent` 对象都包含以下属性: |
content/docs/reference-events.md
Outdated
> | ||
> As of v0.14, returning `false` from an event handler will no longer stop event propagation. Instead, `e.stopPropagation()` or `e.preventDefault()` should be triggered manually, as appropriate. | ||
> 截止 v0.14 ,事件处理程序返回 `false` 不再阻止事件传播。相反,`e.stopPropagation()` 或者 `e.preventDefault()` 应适当的手动触发。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> 截止 v0.14 ,事件处理程序返回 `false` 不再阻止事件传播。相反,`e.stopPropagation()` 或者 `e.preventDefault()` 应适当的手动触发。 | |
> 截止 v0.14,当事件处理函数返回 `false` 时,不再阻止事件冒泡。你可以选择使用 `e.stopPropagation()` 或者 `e.preventDefault()` 替代。 |
content/docs/reference-events.md
Outdated
|
||
React normalizes events so that they have consistent properties across different browsers. | ||
React 使事件正常化,所以他们在不同浏览器中有一致的属性。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React 使事件正常化,所以他们在不同浏览器中有一致的属性。 | |
React 使事件规范化,因此它们在不同浏览器中拥有相同的属性。 |
content/docs/reference-events.md
Outdated
|
||
The event handlers below are triggered by an event in the bubbling phase. To register an event handler for the capture phase, append `Capture` to the event name; for example, instead of using `onClick`, you would use `onClickCapture` to handle the click event in the capture phase. | ||
以下的事件处理函数在冒泡阶段被事件触发。要在注册捕获阶段的事件处理函数,需要为事件名称添加 `Capture` 。例如,不是使用 `onClick` ,而是使用 `onClickCapture` 处理捕获阶段的点击事件。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
以下的事件处理函数在冒泡阶段被事件触发。要在注册捕获阶段的事件处理函数,需要为事件名称添加 `Capture` 。例如,不是使用 `onClick` ,而是使用 `onClickCapture` 处理捕获阶段的点击事件。 | |
以下的事件处理函数在冒泡阶段被触发。如需注册捕获阶段的事件处理函数,则应为事件名添加 `Capture`。例如,处理捕获阶段的点击事件请使用 `onClickCapture`,而不是 `onClick`。 |
|
||
``` | ||
onClick onContextMenu onDoubleClick onDrag onDragEnd onDragEnter onDragExit | ||
onDragLeave onDragOver onDragStart onDrop onMouseDown onMouseEnter onMouseLeave | ||
onMouseMove onMouseOut onMouseOver onMouseUp | ||
``` | ||
`onMouseEnter` 和 `onMouseLeave` 事件从离开的元素向进入的元素传播,不是正常的冒泡,也没有捕获阶段。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`onMouseEnter` 和 `onMouseLeave` 事件从离开的元素向进入的元素传播,不是正常的冒泡,也没有捕获阶段。 | |
`onMouseEnter` 和 `onMouseLeave` 事件从离开的元素向进入的元素传播,不是正常的冒泡,也没有捕获阶段。 |
|
||
``` | ||
onPointerDown onPointerMove onPointerUp onPointerCancel onGotPointerCapture | ||
onLostPointerCapture onPointerEnter onPointerLeave onPointerOver onPointerOut | ||
``` | ||
`onPointerEnter` 和 `onPointerLeave` 事件从离开的元素向进入的元素传播,不是正常的冒泡,也没有捕获阶段。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`onPointerEnter` 和 `onPointerLeave` 事件从离开的元素向进入的元素传播,不是正常的冒泡,也没有捕获阶段。 | |
`onPointerEnter` 和 `onPointerLeave` 事件从离开的元素向进入的元素传播,不是正常的冒泡,也没有捕获阶段。 |
content/docs/reference-events.md
Outdated
|
||
Pointer events are not yet supported in every browser (at the time of writing this article, supported browsers include: Chrome, Firefox, Edge, and Internet Explorer). React deliberately does not polyfill support for other browsers because a standard-conform polyfill would significantly increase the bundle size of `react-dom`. | ||
并非每个浏览器都支持指针事件(在写这篇文章时,支持的浏览器有:Chrome,Firefox,Edge,和 Internet Explorer)。React 有意没有通过 polyfill 支持其他浏览器,因为符合标准的 polyfill 会显著增加 react-dom 的包大小。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
并非每个浏览器都支持指针事件(在写这篇文章时,支持的浏览器有:Chrome,Firefox,Edge,和 Internet Explorer)。React 有意没有通过 polyfill 支持其他浏览器,因为符合标准的 polyfill 会显著增加 react-dom 的包大小。 | |
并非每个浏览器都支持指针事件(在写这篇文章时,已支持的浏览器有:Chrome,Firefox,Edge 和 Internet Explorer)。React 故意不通过 polyfill 的方式适配其他浏览器,主要是符合标准的 polyfill 会显著增加 react-dom 的 bundle 大小。 |
Deploy preview for zh-hans-reactjs ready! Built with commit ae22e81 |
content/docs/reference-events.md
Outdated
|
||
React normalizes events so that they have consistent properties across different browsers. | ||
React 使事件规范化,因此它们在不同浏览器中拥有相同的属性。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React 通过将事件 normalize 以让它们在不同浏览器中拥有一致的属性?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ryanhui 修改下~
permalink: docs/events.html | ||
layout: docs | ||
category: Reference | ||
--- | ||
|
||
This reference guide documents the `SyntheticEvent` wrapper that forms part of React's Event System. See the [Handling Events](/docs/handling-events.html) guide to learn more. | ||
此参考指南记录了构成 React 事件系统一部分的 `SyntheticEvent` 包装器。请参考有关[事件处理](/docs/handling-events.html)的指南来了解更多。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此参考指南记录了构成 React 事件系统一部分的 SyntheticEvent
包装器。请参考事件处理的指南来了解更多。
- 不需要「有关」吧,这个文档直接就是讲「事件处理」的呀
|
||
If you find that you need the underlying browser event for some reason, simply use the `nativeEvent` attribute to get it. Every `SyntheticEvent` object has the following attributes: | ||
如果因为某些原因,当你需要使用浏览器的底层事件时,只需要使用 `nativeEvent` 属性来获取即可。每个 `SyntheticEvent` 对象都包含以下属性: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当你出于某些原因,必须使用浏览器的底层事件时,你只需使用 nativeEvent
属性即可获取。每个 SyntheticEvent
对象都包含以下属性:
> | ||
> As of v0.14, returning `false` from an event handler will no longer stop event propagation. Instead, `e.stopPropagation()` or `e.preventDefault()` should be triggered manually, as appropriate. | ||
> 截止 v0.14,当事件处理函数返回 `false` 时,不再阻止事件冒泡。你可以选择使用 `e.stopPropagation()` 或者 `e.preventDefault()` 替代。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
自 v0.14 起,从事件处理函数中返回
false
将不再阻止事件冒泡。更恰当的做法是使用e.stopPropagation()
或者e.preventDefault()
手动触发。
|
||
If your application requires pointer events, we recommend adding a third party pointer event polyfill. | ||
如果你的应用要求指针事件,我们推荐添加第三方的指针事件 polyfil 。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果你的应用需要用到指针事件,我们建议你添加第三方的指针事件 polyfill。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不过,这个 React 是不是已经支持了?
No description provided.