提交 809e14d1 编写于 作者: E ester.zhou

Update docs (20280)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 d541cf39
......@@ -34,6 +34,12 @@ Obtains the snapshot of a component that has been loaded. This API uses an async
| id | string | Yes | [ID](../arkui-ts/ts-universal-attributes-component-id.md) of the target component.|
| callback | AsyncCallback&lt;image.PixelMap&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | ------------------- |
| 100001 | if id is not valid. |
**Example**
```js
......@@ -159,6 +165,12 @@ Renders a custom component in the application background and outputs its snapsho
| builder | [CustomBuilder](../arkui-ts/ts-types.md#custombuilder8) | Yes | Builder of the custom component.|
| callback | AsyncCallback&lt;image.PixelMap&gt; | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------------------------- |
| 100001 | if builder is not a valid build function. |
**Example**
```ts
......
......@@ -31,6 +31,18 @@ Creates a **DrawableDescriptor** object when the passed resource ID or name belo
Creates a **LayeredDrawableDescriptor** object when the passed resource ID or name belongs to a JSON file that contains foreground and background resources.
The content of the **drawble.json** file is as follows:
```json
{
"layered-image":
{
"background" : "$media:background",
"foreground" : "$media:foreground"
}
}
```
**Example**
```ts
// xxx.ets
......@@ -45,7 +57,7 @@ struct Index {
Row() {
Column() {
Image((<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.icon').id))))
Image(((<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.icon')
Image(((<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.drawable')
.id))).getForeground()).getPixelMap())
}.height('50%')
}.width('50%')
......@@ -68,7 +80,8 @@ Obtains this **pixelMap** object.
**Example**
```ts
pixmap: PixelMap = drawable1.getPixelMap();
pixmap: PixelMap = (<DrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.icon')
.id))).getPixelMap();
```
## LayeredDrawableDescriptor.getPixelMap
......@@ -86,7 +99,8 @@ Obtains the **pixelMap** object where the foreground, background, and mask are b
**Example**
```ts
pixmap: PixelMap = layeredDrawable1.getPixelMap();
pixmap: PixelMap = (<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.drawable')
.id))).getPixelMap();
```
## LayeredDrawableDescriptor.getForeground
......@@ -104,7 +118,8 @@ Obtains the **DrawableDescriptor** object of the foreground.
**Example**
```ts
drawable: DrawableDescriptor = layeredDrawable1.getForeground();
drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.drawable')
.id))).getForeground();
```
## LayeredDrawableDescriptor.getBackground
......@@ -122,7 +137,8 @@ Obtains the **DrawableDescriptor** object of the background.
**Example**
```ts
drawable: DrawableDescriptor = layeredDrawable1.getBackground();
drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.drawable')
.id))).getBackground();
```
## LayeredDrawableDescriptor.getMask
......@@ -140,5 +156,6 @@ Obtains the **DrawableDescriptor** object of the mask.
**Example**
```ts
drawable: DrawableDescriptor = layeredDrawable1.getMask();
drawable: DrawableDescriptor = (<LayeredDrawableDescriptor> (this.resManager.getDrawableDescriptor($r('app.media.drawable')
.id))).getMask();
```
......@@ -34,12 +34,14 @@ Registers a custom font with the font manager.
## FontOptions
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| familyName | string | Yes | Name of the custom font to register. |
| familySrc | string | Yes | Path of the custom font to register.|
## Example
**Example**
```ts
// xxx.ets
......@@ -68,7 +70,7 @@ struct FontExample {
}
}
```
## font.getSystemFontList
## font.getSystemFontList<sup>10+</sup>
getSystemFontList(): Array\<string>
......@@ -82,7 +84,7 @@ Obtains the list of supported fonts.
| -------------------- | ----------------- |
| Array\<string> | List of supported fonts. |
## Example
**Example**
```ts
// xxx.ets
......@@ -105,7 +107,7 @@ struct FontExample {
}
```
## font.getFontByName
## font.getFontByName<sup>10+</sup>
getFontByName(fontName: string): FontInfo;
......@@ -127,18 +129,22 @@ Obtains information about a system font based on the font name.
## FontInfo
| Name | Type | Description |
| -------------- | ------- | ------------------------- |
| path | string | File path of the system font. |
| postScriptName | string | PostScript name of the system font.|
| fullName | string | Name of the system font. |
| family | string | Family of the system font. |
| subfamily | string | Subfamily of the system font. |
| weight | number | Weight of the system font. |
| width | number | Width of the system font. |
| italic | boolean | Whether the system font is italic. |
| monoSpace | boolean | Whether the system font is monospaced. |
| symbolic | boolean | Whether the system font supports symbols. |
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| -------------- | ------- | ------------------------- | ------------------------- |
| path | string | Yes| File path of the system font. |
| postScriptName | string | Yes| PostScript name of the system font.|
| fullName | string | Yes| Name of the system font. |
| family | string | Yes| Family of the system font. |
| subfamily | string | Yes| Subfamily of the system font. |
| weight | number | Yes| Weight of the system font. |
| width | number | Yes| Width of the system font. |
| italic | boolean | Yes| Whether the system font is italic. |
| monoSpace | boolean | Yes| Whether the system font is monospaced. |
| symbolic | boolean | Yes| Whether the system font supports symbols. |
**Example**
```ts
// xxx.ets
......@@ -169,4 +175,3 @@ struct FontExample {
}
}
```
......@@ -16,7 +16,7 @@ import matrix4 from '@ohos.matrix4'
## matrix4.init
init(option: [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number]): Matrix4Transit
init(options: [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number]): Matrix4Transit
Matrix constructor, which is used to create a 4 x 4 matrix by using the input parameter. Column-major order is used.
......@@ -27,7 +27,7 @@ Matrix constructor, which is used to create a 4 x 4 matrix by using the input pa
| Name| Type | Mandatory| Description |
| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| option | [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number] | Yes | A number array whose length is 16 (4 x 4). For details, see **Description of a 4 x 4 matrix**.<br>Default value:<br>[1, 0, 0, 0,<br>0, 1, 0, 0,<br>0, 0, 1, 0,<br>0, 0, 0, 1] |
| option | [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number] | Yes | A number array whose length is 16 (4 x 4). For details, see **Description of a 4 x 4 matrix**.<br>Default value:<br>[1,&nbsp;0,&nbsp;0,&nbsp;0,<br>0,&nbsp;1,&nbsp;0,&nbsp;0,<br>0,&nbsp;0,&nbsp;1,&nbsp;0,<br>0,&nbsp;0,&nbsp;0,&nbsp;1] |
**Return value**
......@@ -176,7 +176,7 @@ struct Test {
### combine
combine(option: Matrix4Transit): Matrix4Transit
combine(options: Matrix4Transit): Matrix4Transit
Combines the effects of two matrices to generate a new matrix object.
......@@ -273,7 +273,7 @@ struct Tests {
### translate
translate(option: TranslateOption): Matrix4Transit
translate(options: TranslateOption): Matrix4Transit
Translates this matrix object along the x, y, and z axes.
......@@ -317,7 +317,7 @@ struct Test {
### scale
scale(option: ScaleOption): Matrix4Transit
scale(options: ScaleOption): Matrix4Transit
Scales this matrix object along the x, y, and z axes.
......@@ -362,7 +362,7 @@ struct Test {
### rotate
rotate(option: RotateOption): Matrix4Transit
rotate(options: RotateOption): Matrix4Transit
Rotates this matrix object along the x, y, and z axes.
......@@ -408,7 +408,7 @@ struct Test {
### transformPoint
transformPoint(option: [number, number]): [number, number]
transformPoint(options: [number, number]): [number, number]
Applies the current transformation effect to a coordinate point.
......@@ -466,14 +466,18 @@ struct Test {
## TranslateOption
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ----------------------------------------------------------- |
| ---- | ------ | ---- | ----------------------------------------------------------- |
| x | number | No | Translation distance along the x-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)|
| y | number | No | Translation distance along the y-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)|
| z | number | No | Translation distance along the z-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)|
## ScaleOption
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------------ |
| x | number | No | Scaling multiple along the x-axis. If the value is greater than 1, the image is scaled up along the x-axis. If the value is less than 1, the image is scaled down along the x-axis.<br>Default value: **1**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value.|
......@@ -484,6 +488,8 @@ struct Test {
## RotateOption
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------- |
| x | number | No | X coordinate of the rotation axis vector.<br>Default value: **1**<br>Value range: (-∞, +∞)|
......
......@@ -262,7 +262,7 @@ pluginComponentManager.push(
name: "ets/pages/plugin2.js",
data: {
"js": "ets/pages/plugin.js",
"key_1": 1111, ,
"key_1": 1111,
},
extraData: {
"extra_str": "this is push event"
......@@ -376,10 +376,24 @@ Listens for events of the request type and returns the requested data, or listen
| eventType | string | Yes | Type of the event to listen for. The options are as follows:<br>**"push"**: The component provider pushes data to the component consumer.<br>**"request"**: The component consumer proactively requests data from the component provider.|
| callback | [OnPushEventCallback](#onpusheventcallback)&nbsp;\|&nbsp;[OnRequestEventCallback](#onrequesteventcallback) | Yes | Callback used to return the result. The type is [OnPushEventCallback](#onpusheventcallback) for the push event and [OnRequestEventCallback](#onrequesteventcallback) for the request event.|
**Example**
```js
function onPushListener(source, template, data, extraData) {
console.log("onPushListener template.source=" + template.source)
console.log("onPushListener source=" + JSON.stringify(source))
console.log("onPushListener template=" + JSON.stringify(template))
console.log("onPushListener data=" + JSON.stringify(data))
console.log("onPushListener extraData=" + JSON.stringify(extraData))
}
function onRequestListener(source, name, data) {
console.error("onRequestListener");
console.log("onRequestListener source=" + JSON.stringify(source));
console.log("onRequestListener name=" + name);
console.log("onRequestListener data=" + JSON.stringify(data));
return { template: "ets/pages/plugin.js", data: data };
}
pluginComponentManager.on("push", onPushListener)
pluginComponentManager.on("request", onRequestListener)
```
......
......@@ -604,7 +604,7 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message|
| --------- | ------- |
| 100001 | if UI execution context not found. |
| 100001 | if UI execution context not found, only throw in standard system. |
| 100004 | if the named route is not exist. |
**Example**
......@@ -645,7 +645,7 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message|
| --------- | ------- |
| 100001 | if UI execution context not found. |
| 100001 | if UI execution context not found, only throw in standard system. |
| 100004 | if the named route is not exist. |
**Example**
......@@ -693,7 +693,7 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message|
| --------- | ------- |
| 100001 | if can not get the delegate. |
| 100001 | if UI execution context not found, only throw in standard system. |
| 100004 | if the named route is not exist. |
**Example**
......@@ -735,7 +735,7 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message|
| --------- | ------- |
| 100001 | if UI execution context not found. |
| 100001 | if UI execution context not found, only throw in standard system. |
| 100004 | if the named route is not exist. |
**Example**
......@@ -1054,7 +1054,7 @@ struct Second {
Text(this.text)
.fontSize(30)
.onClick(() => {
this.secondData = (this.data.['array'][1]).toString()
this.secondData = (this.data['array'][1]).toString()
})
.margin({ top: 20 })
Text(`This is the data passed from the first page: ${this.secondData}`)
......
......@@ -22,7 +22,7 @@ The operation for obtaining the rendering engine or parsing parameters fails.
NA
## 100002 Incorrect URI
## 100002 Incorrect URI During Page Redirection
**Error Message**
......@@ -58,7 +58,21 @@ Too many pages are pushed.
Delete unnecessary or invalid pages.
## 200002 Incorrect URI
## 100004 Incorrect Route Name
**Error Message**
Named route error. The named route is not exist.
**Description**
This error code is reported when the specified route name for redirection is incorrect or does not exist.
**Possible Causes**
The specified route name for redirection is incorrect or does not exist.
## 200002 Incorrect URI During Page Replacement
**Error Message**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册