提交 03bd62e0 编写于 作者: G guozejun

fix review advice

Signed-off-by: Nguozejun <guozejun@huawei.com>
Change-Id: If2c1dd2a1727722d71e9ec4b7fdc73c9e2d2c851
上级 dc690ee8
......@@ -118,16 +118,63 @@ struct IndexComponent {
## onLayout<sup>9+</sup>
onLayout?(children: Array<LayoutChild>, constraint: [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions)): void
onLayout?(children: Array\<LayoutChild\>, constraint: [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions)): void
**参数:**
| 参数名 | 类型 | 说明 |
| ---------- | -------------------------------------------------------------------------------- | -------------------- |
| children | Array\<[LayoutChild](#layoutchild9)\> | 子组件布局信息 |
| constraint | [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions) | 父组件constraint信息 |
框架会在自定义组件布局时,将该自定义组件的子节点信息和自身的尺寸范围通过onLayout传递给该自定义组件。不允许在onLayout函数中改变状态变量。
## onMeasure<sup>9+</sup>
onMeasure?(children: Array<LayoutChild>, constraint: [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions)): void
onMeasure?(children: Array\<LayoutChild\>, constraint: [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions)): void
**参数:**
| 参数名 | 类型 | 说明 |
| ---------- | -------------------------------------------------------------------------------- | -------------------- |
| children | Array\<[LayoutChild](#layoutchild9)\> | 子组件布局信息 |
| constraint | [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions) | 父组件constraint信息 |
框架会在自定义组件确定尺寸时,将该自定义组件的子节点信息和自身的尺寸范围通过onMeasure传递给该自定义组件。不允许在onMeasure函数中改变状态变量。
## LayoutChild<sup>9+</sup>
子组件布局信息
| 参数 | 参数类型 | 描述 |
| ---------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| name | string | 子组件名称 |
| id | string | 子组件id |
| constraint | [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions) | 子组件约束尺寸 |
| borderInfo | [LayoutBorderInfo](#layoutborderinfo9) | 子组件border信息 |
| position | [Position](../reference/arkui-ts/ts-types.md#position) | 子组件位置坐标 |
| measure | (childConstraint: [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions)) => void | 调用此方法对子组件的尺寸范围进行限制 |
| layout | (LayoutInfo: [LayoutInfo](#layoutinfo9)) => void | 调用此方法对子组件的位置信息进行限制 |
## LayoutBorderInfo<sup>9+</sup>
子组件border信息
| 参数 | 参数类型 | 描述 |
| ----------- | ---------------------------------------------------------- | ---------------------------------------------- |
| borderWidth | [EdgeWidths](../reference/arkui-ts/ts-types.md#edgewidths) | 边框宽度类型,用于描述组件边框不同方向的宽度。 |
| margin | [Margin](../reference/arkui-ts/ts-types.md#margin) | 外边距类型,用于描述组件不同方向的外边距。 |
| padding | [Padding](../reference/arkui-ts/ts-types.md#padding) | 内边距类型,用于描述组件不同方向的内边距。 |
## LayoutInfo<sup>9+</sup>
子组件layout信息
| 参数 | 参数类型 | 描述 |
| ---------- | -------------------------------------------------------------------------------- | -------------- |
| position | [Position](../reference/arkui-ts/ts-types.md#position) | 子组件位置坐标 |
| constraint | [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions) | 子组件约束尺寸 |
**示例3:**
```ts
......@@ -176,36 +223,3 @@ struct CustomLayout {
```
![customlayout](figures/customLayout.png)
## LayoutChild<sup>9+</sup>
子组件布局信息
| 参数 | 参数类型 | 描述 |
| ---------- | ----------------------------------------------------------------------------------------------------------- | ---------------- |
| name | string | 子组件名称 |
| id | string | 子组件id |
| constraint | [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions) | 子组件约束尺寸 |
| borderInfo | [LayoutBorderInfo](#layoutborderinfo9) | 子组件border信息 |
| position | [Position](../reference/arkui-ts/ts-types.md#position) | 子组件位置坐标 |
| measure | (childConstraint: [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions)) => void | 子组件位置坐标 |
| layout | (LayoutInfo: [LayoutInfo](#layoutinfo9)) => void | 子组件位置坐标 |
## LayoutBorderInfo<sup>9+</sup>
子组件border信息
| 参数 | 参数类型 | 描述 |
| ----------- | ---------------------------------------------------------- | -------------------------------------------- |
| borderWidth | [EdgeWidths](../reference/arkui-ts/ts-types.md#edgewidths) | 边框宽度类型,用于描述组件边框不同方向的宽度 |
| margin | [Margin](../reference/arkui-ts/ts-types.md#margin) | 外边距类型,用于描述组件不同方向的外边距 |
| padding | [Padding](../reference/arkui-ts/ts-types.md#padding) | 内边距类型,用于描述组件不同方向的内边距 |
## LayoutInfo<sup>9+</sup>
子组件layout信息
| 参数 | 参数类型 | 描述 |
| ---------- | -------------------------------------------------------------------------------- | -------------- |
| position | [Position](../reference/arkui-ts/ts-types.md#position) | 子组件位置坐标 |
| constraint | [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions) | 子组件约束尺寸 |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册