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

!8185 翻译完成 7241:修改组件示例代码效果与文档不符

Merge pull request !8185 from ester.zhou/TR-7241
......@@ -49,7 +49,9 @@ RichText\(content:string\)
## Example
```
You can preview how this component looks on a real device. The preview is not yet available in the DevEco Studio Previewer.
```ts
// xxx.ets
@Entry
@Component
struct RichTextExample {
......
# XComponent
> **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
> **NOTE**
>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **\<XComponent>** can accept and display the EGL/OpenGLES and media data input.
The **\<XComponent>** can accept and display the EGL/OpenGL ES and media data input.
## Required Permissions
......@@ -19,20 +20,20 @@
- Name
| Name | Type | Mandatory | Description |
| ----------- | --------------------------------------- | --------- | ------------------------------------------------------------ |
| id | string | Yes | Unique ID of the component. The value can contain a maximum of 128 characters. |
| type | string | Yes | Type of the component. The options are as follows:<br>- **surface**: The content of this component is displayed individually, without being combined with that of other components.<br>- **component**: The content of this component is displayed after having been combined with that of other components. |
| libraryname | string | No | Name of the dynamic library generated after compilation at the application native layer. |
| controller | [XComponentController](#XComponentController) | No | Controller bound to the component, which can be used to invoke methods of the component. |
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| id | string | Yes | Unique ID of the component. The value can contain a maximum of 128 characters. |
| type | string | Yes | Type of the component. The options are as follows:<br>-**surface**: The content of this component is displayed individually, without being combined with that of other components.<br>-**component**: The content of this component is displayed after having been combined with that of other components.|
| libraryname | string | No | Name of the dynamic library generated after compilation at the application native layer. |
| controller | [XComponentController](#XComponentController) | No | Controller bound to the component, which can be used to invoke methods of the component. |
## Events
| Name | Description |
| ------------------------------- | ------------------------ |
| onLoad(context?: object) => void | Triggered when the plug-in is loaded. |
| onDestroy() => void | Triggered when the plug-in is destroyed. |
| Name | Description |
| -------------------------------- | ------------ |
| onLoad(context?: object) => void | Triggered when the plug-in is loaded.|
| onDestroy() => void | Triggered when the plug-in is destroyed.|
## XComponentController
......@@ -52,9 +53,9 @@ Obtains the ID of the surface held by the **\<XComponent>**. The ID can be used
- Return value
| Type | Description |
| ------ | --------------------------- |
| string | ID of the surface held by the **\<XComponent>**. |
| Type | Description |
| ------ | ----------------------- |
| string | ID of the surface held by the **\<XComponent>**.|
### setXComponentSurfaceSize
......@@ -64,10 +65,10 @@ Sets the width and height of the surface held by the **\<XComponent>**.
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| ------------- | -------- | ---- | ------ | ----------------------------- |
| surfaceWidth | number | Yes | - | Width of the surface held by the **\<XComponent>**. |
| surfaceHeight | number | Yes | - | Height of the surface held by the **\<XComponent>**. |
| Name | Type | Mandatory | Default Value | Description |
| ------------- | ------ | ---- | ---- | ----------------------- |
| surfaceWidth | number | Yes | - | Width of the surface held by the **\<XComponent>**.|
| surfaceHeight | number | Yes | - | Height of the surface held by the **\<XComponent>**.|
### getXComponentContext
......@@ -77,13 +78,15 @@ Obtains the context of an **\<XComponent>** object.
- Return value
| Type | Description |
| ------ | ------------------------------------------------------------ |
| Object | Context of an **\<XComponent>** object. The APIs contained in the context are defined by developers. |
| Type | Description |
| ------ | ---------------------------------------- |
| Object | Context of an **\<XComponent>** object. The APIs contained in the context are defined by developers.|
## Example
Provide a surface-type **\<XComponent>** to support capabilities such as camera preview.
Provide a surface-type **\<XComponent>** to support capabilities such as camera preview.
You can preview how this component looks on a real device. The preview is not yet available in the DevEco Studio Previewer.
```ts
// xxx.ets
......
# Z-order Control
The **zIndex** attribute sets the z-order of a component in the stacking context.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
> This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
......@@ -13,15 +14,16 @@ None
## Attributes
| Name | Type | Default Value | Description |
| Name | Type | Default Value | Description |
| -------- | -------- | -------- | -------- |
| zIndex | number | 0 | Hierarchy of sibling components in a container. A larger z-order value indicates a higher display level. |
| zIndex | number | 0 | Hierarchy of sibling components in a container. A larger value indicates a higher display level. |
## Example
```
```ts
// xxx.ets
@Entry
@Component
struct ZIndexExample {
......@@ -38,7 +40,7 @@ struct ZIndexExample {
Text('third child, zIndex(1)')
.size({width: '70%', height: '50%'}).backgroundColor(0xc1cbac).align(Alignment.TopStart)
.zIndex(1)
}
}.width('100%').height(200)
}.width('100%').height(200)
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册