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

update docs

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 1a2240a7
......@@ -8,7 +8,7 @@
## Modules to Import
```
import inputMethod from '@ohos.inputMethod';
import inputMethod from '@ohos.inputmethod';
```
## inputMethod<sup>6+</sup>
......
......@@ -7,7 +7,7 @@
## Modules to Import
```
import inputMethodEngine from '@ohos.inputMethodEngine';
import inputMethodEngine from '@ohos.inputmethodengine';
```
## inputMethodEngine
......
# Screen Lock Management
The **screenlock** module is a system module in OpenHarmony. It provides APIs for screen lock applications to subscribe to screen lock status changes as well as callbacks for them to receive the results. It also provides APIs for third-party applications to unlock the screen, obtain the screen locked status, and check whether a lock screen password has been set.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -17,17 +19,17 @@ import screenlock from '@ohos.screenLock';
isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void
Checks whether the screen is locked. This method uses an asynchronous callback to return the result.
Checks whether the screen is locked. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
- Parameters
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback&nbsp;used&nbsp;to&nbsp;return&nbsp;the&nbsp;result.&nbsp;If&nbsp;**true**&nbsp;is&nbsp;returned,&nbsp;the&nbsp;screen&nbsp;is&nbsp;locked.&nbsp;If&nbsp;**false**&nbsp;is&nbsp;returned,&nbsp;the&nbsp;screen&nbsp;is&nbsp;not&nbsp;locked. |
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes| Returns **true** if the screen is locked; returns **false** otherwise.|
**Example**
- Example
```js
screenlock.isScreenLocked((err, data)=>{
if (err) {
......@@ -43,17 +45,17 @@ Checks whether the screen is locked. This method uses an asynchronous callback t
isScreenLocked(): Promise&lt;boolean&gt;
Checks whether the screen is locked. This method uses a promise to return the result.
Checks whether the screen is locked. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
- Return Values
| Type | Description |
| -------- | -------- |
| Promise&lt;boolean&gt; | Promise&nbsp;used&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
**Example**
- Example
```js
screenlock.isScreenLocked().then((data) => {
console.log('isScreenLocked success: data -> ${JSON.stringify(data)}');
......@@ -68,19 +70,19 @@ Checks whether the screen is locked. This method uses a promise to return the re
isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void
Checks whether a device is in secure mode. This method uses an asynchronous callback to return the result.
Checks whether a device is in secure mode. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
- Parameters
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback&nbsp;used&nbsp;to&nbsp;return&nbsp;the&nbsp;result.&nbsp;If&nbsp;**true**&nbsp;is&nbsp;returned,&nbsp;the&nbsp;device&nbsp;is&nbsp;in&nbsp;secure&nbsp;mode.&nbsp;If&nbsp;**false**&nbsp;is&nbsp;returned,&nbsp;the&nbsp;device&nbsp;is&nbsp;not&nbsp;in&nbsp;secure&nbsp;mode. |
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes| Returns **true** if the device is in secure mode; returns **false** otherwise.|
**Example**
- Example
```js
screenlock.isSecureMode((err, data)=>{
if (err) {
......@@ -96,17 +98,17 @@ Checks whether a device is in secure mode. This method uses an asynchronous call
isSecureMode(): Promise&lt;boolean&gt;
Checks whether a device is in secure mode. This method uses a promise to return the result.
Checks whether a device is in secure mode. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
- Return Values
| Type | Description |
| -------- | -------- |
| Promise&lt;boolean&gt; | Promise&nbsp;used&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
**Example**
- Example
```js
screenlock.isSecureMode().then((data) => {
console.log('isSecureMode success: data->${JSON.stringify(data)}');
......@@ -121,21 +123,21 @@ Checks whether a device is in secure mode. This method uses a promise to return
unlockScreen(callback: AsyncCallback&lt;void&gt;): void
Unlocks the screen. This method uses an asynchronous callback to return the result.
Unlocks the screen. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
- Parameters
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback&nbsp;function.&nbsp;If&nbsp;the&nbsp;callback&nbsp;fails,&nbsp;an&nbsp;error&nbsp;message&nbsp;is&nbsp;returned. |
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation failed, an error message is returned.|
**Example**
- Example
```js
screenlock.unlockScreen((err)=>{
screenlock.unlockScreen((err) => {
if (err) {
console.error('unlockScreen callback error -> ${JSON.stringify(err)}');
return;
......@@ -149,17 +151,17 @@ Unlocks the screen. This method uses an asynchronous callback to return the resu
unlockScreen(): Promise&lt;void&gt;
Unlocks the screen. This method uses a promise to return the result.
Unlocks the screen. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.ScreenLock
- Return Values
| Type | Description |
| -------- | -------- |
| Promise&lt;void&gt; | Promise&nbsp;used&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
- Example
```js
screenlock.unlockScreen().then(() => {
console.log('unlockScreen success');
......
# Grid
> **NOTE**
>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **\<Grid>** component consists of cells formed by rows and columns. You can specify the cells where items are located to form various layouts.
The **&lt;Grid&gt;** component is a two-dimensional layout. The component is divided into rows and columns, to form cells. You can specify the cell where an item is located and combine different grids to form various layouts.
## Required Permissions
......@@ -13,9 +14,10 @@ The **&lt;Grid&gt;** component is a two-dimensional layout. The component is div
None
## Child Components
This component contains the child component [\<GridItem>](ts-container-griditem.md).
This component contains the child component **[\<GridItem>](ts-container-griditem.md)**.
## APIs
......@@ -25,38 +27,30 @@ Grid()
## Attributes
| Name | Type | Default Value | Description |
| Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- |
| columnsTemplate | string | '1fr' | Number of columns in the current grid layout. If this parameter is not set, one column is used by default. For example, '1fr 1fr 2fr' divides the component into three columns, with four equal parts. The first column occupies one part, the second column occupies one part, and the third column occupies two parts. |
| rowsTemplate | string | '1fr' | Number of rows in the current grid layout. If this parameter is not set, one row is used by default. For example, '1fr 1fr 2fr' divides the component into three rows. The width allowed by the parent component is divided into four equal parts. The first row occupies one part, the second row occupies one part, and the third row occupies two parts. |
| columnsGap | Length | 0 | Spacing between columns. |
| rowsGap | Length | 0 | Spacing between rows. |
| editMode<sup>8+</sup> | boolean | false | Whether to enter editing mode. In editing mode, you can drag the **&lt;[GridItem](ts-container-griditem.md)&gt;** in the **&lt;Gird&gt;** component. |
| layoutDirection<sup>8+</sup> | [LayoutDirection](ts-appendix-enums.md#layoutdirection-enums) | LayoutDirection.Row | Main axis direction of the layout. The options are as follows:- **LayoutDirection.Row**: Horizontal layout, where the child components are arranged in the same direction as the main axis runs along the rows.- **LayoutDirection.Column**: Vertical layout, where the child components are arranged in the same direction as the main axis runs down the columns. |
| maxCount<sup>8+</sup> | number | 1 | Maximum number of rows that can be displayed. |
| minCount<sup>8+</sup> | number | 1 | Minimum number of rows that can be displayed. |
| cellLength<sup>8+</sup> | number | 0 | Fixed height per row. |
| multiSelectable<sup>8+</sup> | boolean | false | Whether to enable mouse frame selection.<br/>- **false**: The mouse frame selection is disabled.<br/>- **true**: The mouse frame selection is disabled. |
| edgeEffection<sup>8+</sup> | EdgeEffect | EdgeEffect.Spring | Edge effect. For details, see **EdgeEffect**. |
- EdgeEffect enums
| Name | Description |
| ------ | ------------------------------------------------------------ |
| Spring | Similar to the physical dynamic effect of a spring. After scrolling to the edge, you can continue to scroll for a distance based on the initial speed or by touching the knob of the scrollbar. After you release your hand, the knob is rebounded. |
| None | No effect after the scrollbar is moved to the edge. |
| columnsTemplate | string | '1fr' | Number of columns in the current grid layout. If this parameter is not set, one column is used by default. For example, **'1fr 1fr 2fr'** divides the component into three columns, with four equal parts. The first column occupies one part, the second column occupies one part, and the third column occupies two parts.|
| rowsTemplate | string | '1fr' | Number of rows in the current grid layout. If this parameter is not set, one row is used by default. For example, **'1fr 1fr 2fr'** divides the component into three rows. The width allowed by the parent component is divided into four equal parts. The first row occupies one part, the second row occupies one part, and the third row occupies two parts.|
| columnsGap | Length | 0 | Spacing between columns.|
| rowsGap | Length | 0 | Spacing between rows.|
| editMode<sup>8+</sup> | boolean | flase | Whether to enter editing mode. In editing mode, you can drag the **\<[GridItem](ts-container-griditem.md)>** in the **\<Grid>** component.|
| layoutDirection<sup>8+</sup> | number | 0 |Main axis direction of the layout. The options are as follows:<br>- **0**: Horizontal layout, where the child components are arranged in the same direction as the main axis runs along the rows.<br>- **1**: Vertical layout, where the child components are arranged in the same direction as the main axis runs down the columns.|
| maxCount<font color=ff0000><sup>8+</sup></font> | number | 1 | When **layoutDirection** is **Row**: maximum number of rows that can be displayed.<br>When **layoutDirection** is **Column**: maximum number of columns that can be displayed.|
| minCount<font color=ff0000><sup>8+</sup></font> | number | 1 | When **layoutDirection** is **Row**: minimum number of rows that can be displayed.<br>When **layoutDirection** is **Column**: minimum number of columns that can be displayed.|
| cellLength<font color=ff0000><sup>8+</sup></font> | number | 0 | When **layoutDirection** is **Row**: fixed height per row.<br>When **layoutDirection** is **Column**: fixed width per column.|
| multiSelectable<font color=ff0000><sup>8+</sup></font> | boolean | false | Whether to enable mouse frame selection.<br>- **false**: The mouse frame selection is disabled.<br>- **true**: The mouse frame selection is enabled.|
## Events
| Name | Description |
| Name| Description|
| -------- | -------- |
| onScrollIndex(first: number) =&gt; void | Triggered when the start item of the grid changes. |
| onScrollIndex(first: number) =&gt; void | Triggered when the start item of the grid changes. |
## Example
```
```ts
// xxx.ets
@Entry
@Component
struct GridExample {
......
# Path
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **&lt;Path&gt;** component is used to draw a path.
The **\<Path>** component is used to draw a path.
## Required Permissions
......@@ -15,16 +16,28 @@ None
## Child Components
None
Not supported
## APIs
Path(value?: { width?: number | string, height?: number | string, commands?: string })
- Parameters
| me | Type | Mandatory | Default Value | Description |
| -------- | ---------------- | --------- | ------------- | -------------------------------------------------- |
| width | number \| string | No | 0 | Width of the rectangle where the path is located. |
| height | number \| string | No | 0 | Height of the rectangle where the path is located. |
| commands | string | No | '' | Command string for drawing the path. |
## Attributes
| Name | Type | Default Value | Mandatory | Description |
| Name | Type | Default Value | Mandatory | Description |
| -------- | -------- | -------- | -------- | -------- |
| width | Length | 0 | No | Width of the rectangle where the path is located. |
| height | Length | 0 | No | Height of the rectangle where the path is located. |
| commands | string | '' | Yes | Command string for drawing the path. |
| width | number \| string | 0 | No | Width of the rectangle where the path is located. |
| height | number \| string | 0 | No | Height of the rectangle where the path is located. |
| commands | string | '' | No | Command string for drawing the path. |
The supported commands are as follows:
......@@ -42,9 +55,9 @@ The supported commands are as follows:
- S = smooth curveto
- Q = quadratic Bezier curve
- Q = quadratic Belzier curve
- T = smooth quadratic Bezier curveto
- T = smooth quadratic Belzier curveto
- A = elliptical Arc
......@@ -56,7 +69,7 @@ For example, the command **M0 20 L50 50 L50 100 Z** defines a path that starts f
## Example
```
@Entry
@Component
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册