未验证 提交 dd334493 编写于 作者: O openharmony_ci 提交者: Gitee

!8889 翻译完成 7484

Merge pull request !8889 from ester.zhou/TR-7484
# Event Configuration
You can use event methods to configure events supported by components.
You can use event methods to configure events supported by components. Since API version 9, you can obtain the context associated with the current component from the callback. For details, see [Obtaining the Context on an eTS Page](../ability/context-userguide.md).
- Example of using a lambda expression to configure the event of a component:
```ts
// Counter is a private data variable defined in the component.
Button('add counter')
......@@ -15,8 +13,7 @@ You can use event methods to configure events supported by components.
```
- When using an anonymous function expression to configure the event of a component, bind must be used to ensure that the contained components are referenced by this in the function body.
- When using an anonymous function expression to configure the event of a component, **bind** must be used to ensure that the contained components are referenced by **this** in the function body.
```ts
// Counter is a private data variable defined in the component.
Button('add counter')
......@@ -27,7 +24,6 @@ You can use event methods to configure events supported by components.
- Example of using a component's member function to configure the event of the component:
```ts
myClickHandler(): void {
// do something
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册