From ea796c6952aabf3d01bb96604333e7501e8af4f1 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Sat, 1 Sep 2018 14:19:20 +0800 Subject: [PATCH] =?UTF-8?q?docs(API):=20=E7=BF=BB=E8=AF=91=E5=AE=8C?= =?UTF-8?q?=E4=BA=86=20ViewChild?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/content/translations/cn/api-plan.md | 2 +- packages/core/src/metadata/di.ts | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/aio/content/translations/cn/api-plan.md b/aio/content/translations/cn/api-plan.md index 0e8faf9dfc..9d8d7fabd6 100644 --- a/aio/content/translations/cn/api-plan.md +++ b/aio/content/translations/cn/api-plan.md @@ -23,7 +23,7 @@ [x] |router/ActivatedRoute | 2,993 | 0.93 [x] |forms/AbstractControl | 2,930 | 0.91 [x] |router/RouterLink | 2,929 | 0.91 -[ ] |core/ViewChild | 2,870 | 0.89 +[x] |core/ViewChild | 2,870 | 0.89 [x] |core/Directive | 2,767 | 0.86 [x] |router/Routes | 2,331 | 0.72 [ ] |router/RouterModule | 2,227 | 0.69 diff --git a/packages/core/src/metadata/di.ts b/packages/core/src/metadata/di.ts index c568bbdf18..268177b778 100644 --- a/packages/core/src/metadata/di.ts +++ b/packages/core/src/metadata/di.ts @@ -304,6 +304,8 @@ export const ViewChildren: ViewChildrenDecorator = makePropDecorator( /** * Type of the ViewChild decorator / constructor function. * + * ViewChild 的装饰器类型和构造函数 + * * @see `ViewChild`. */ export interface ViewChildDecorator { @@ -314,21 +316,38 @@ export interface ViewChildDecorator { * in the view DOM. If the view DOM changes, and a new child matches the selector, * the property is updated. * + * 属性装饰器,用于配置一个视图查询。 + * 变更检测器会在视图的 DOM 中查找能匹配上该选择器的第一个元素或指令。 + * 如果视图的 DOM 发生了变化,出现了匹配该选择器的新的子节点,该属性就会被更新。 + * * View queries are set before the `ngAfterViewInit` callback is called. * + * 在调用 `NgAfterViewInit` 回调函数之前就会设置这些视图查询。 + * * **Metadata Properties**: * + * **元数据属性**: + * * * **selector** - the directive type or the name used for querying. + * + * **selector** - 用于查询的指令类型或名字。 + * * * **read** - read a different token from the queried elements. * + * **read** - 从查询到的元素中读取另一个令牌。 + * * @usageNotes * * ### Example * + * ### 例子 + * * {@example core/di/ts/viewChild/view_child_howto.ts region='HowTo'} * * ### Example * + * ### 例子 + * * {@example core/di/ts/viewChild/view_child_example.ts region='Component'} * * @Annotation @@ -339,12 +358,16 @@ export interface ViewChildDecorator { /** * Type of the ViewChild metadata. + * + * ViewChild 元数据的类型。 */ export type ViewChild = Query; /** * ViewChild decorator and metadata. * + * ViewChild 装饰器和元数据。 + * * @Annotation */ export const ViewChild: ViewChildDecorator = makePropDecorator(