diff --git a/en/application-dev/Readme-EN.md b/en/application-dev/Readme-EN.md
index 73bbd2d608562535e3272c1a659bcebbd39b125a..f71b814661e652486bf1a61ee3e7c7dd23dbcf4a 100644
--- a/en/application-dev/Readme-EN.md
+++ b/en/application-dev/Readme-EN.md
@@ -24,6 +24,12 @@
- [Multi-HAP Usage Rules](quick-start/multi-hap-rules.md)
- [Multi-HAP Operation Mechanism and Data Communication Modes](quick-start/multi-hap-principles.md)
- [Application Installation and Uninstallation Process](quick-start/application-package-install-uninstall.md)
+ - Shared Package
+ - [Shared Package Overview](quick-start/shared-guide.md)
+ - [HAR](quick-start/har-package.md)
+ - HSP
+ - [In-Application HSP Development](quick-start/in-app-hsp.md)
+ - [Inter-Application HSP Development (for System Applications Only)](quick-start/cross-app-hsp.md)
- Application Configuration Files in Stage Model
- [Application Configuration File Overview (Stage Model)](quick-start/application-configuration-file-overview-stage.md)
- [app.json5 Configuration File](quick-start/app-configuration-file.md)
@@ -36,18 +42,44 @@
- [Resource Categories and Access](quick-start/resource-categories-and-access.md)
- Learning ArkTS
- [Getting Started with ArkTS](quick-start/arkts-get-started.md)
- - ArkTS Syntax (Declarative UI)
- - [Basic UI Description](quick-start/arkts-basic-ui-description.md)
- - State Management
- - [Basic Concepts](quick-start/arkts-state-mgmt-concepts.md)
- - [State Management with Page-level Variables](quick-start/arkts-state-mgmt-page-level.md)
- - [State Management with Application-level Variables](quick-start/arkts-state-mgmt-application-level.md)
- - [Dynamic UI Element Building](quick-start/arkts-dynamic-ui-elememt-building.md)
- - [Rendering Control](quick-start/arkts-rendering-control.md)
- - [Restrictions and Extensions](quick-start/arkts-restrictions-and-extensions.md)
+ - Basic Syntax
+ - [Basic Syntax Overview](quick-start/arkts-basic-syntax-overview.md)
+ - [Declarative UI Description](quick-start/arkts-declarative-ui-description.md)
+ - Custom Component
+ - [Creating a Custom Component](quick-start/arkts-create-custom-components.md)
+ - [Page and Custom Component Lifecycle](quick-start/arkts-page-custom-components-lifecycle.md)
+ - [\@Builder: Custom Builder Function](quick-start/arkts-builder.md)
+ - [\@BuilderParam: @Builder Function Reference](quick-start/arkts-builderparam.md)
+ - [\@Styles: Definition of Resusable Styles](quick-start/arkts-style.md)
+ - [\@Extend: Extension of Built-in Components](quick-start/arkts-extend.md)
+ - [stateStyles: Polymorphic Style](quick-start/arkts-statestyles.md)
+ - State Management
+ - [State Management Overview](quick-start/arkts-state-management-overview.md)
+ - Component State Management
+ - [\@State: State Owned by Component](quick-start/arkts-state.md)
+ - [\@Prop: One-Way Synchronization from Parent to Child Components](quick-start/arkts-prop.md)
+ - [\@Link: Two-Way Synchronization Between Parent and Child Components](quick-start/arkts-link.md)
+ - [\@Provide and \@Consume: Two-Way Synchronization with Descendant Components](quick-start/arkts-provide-and-consume.md)
+ - [\@Observed and \@ObjectLink: Observing Attribute Changes in Nested Class Objects](quick-start/arkts-observed-and-objectlink.md)
+ - Application State Management
+ - [Application State Management Overview](quick-start/arkts-application-state-management-overview.md)
+ - [LocalStorage: UI State Storage](quick-start/arkts-localstorage.md)
+ - [AppStorage: Application-wide UI State Storage](quick-start/arkts-appstorage.md)
+ - [PersistentStorage: Application State Persistence](quick-start/arkts-persiststorage.md)
+ - [Environment: Device Environment Query](quick-start/arkts-environment.md)
+ - Other State Management Features
+ - [Overview of Other State Management Features](quick-start/arkts-other-state-mgmt-functions-overview.md)
+ - [\@Watch: Getting Notified of State Variable Changes](quick-start/arkts-watch.md)
+ - [$$ Syntax: Two-Way Synchronization of Built-in Components](quick-start/arkts-two-way-sync.md)
+ - Rendering Control
+ - [Rendering Control Overview](quick-start/arkts-rendering-control-overview.md)
+ - [if/else: Conditional Rendering](quick-start/arkts-rendering-control-ifelse.md)
+ - [ForEach: Rendering of Repeated Content](quick-start/arkts-rendering-control-foreach.md)
+ - [LazyForEach: Lazy Data Loading](quick-start/arkts-rendering-control-lazyforeach.md)
- Development
- [Application Models](application-models/Readme-EN.md)
- [UI Development](ui/Readme-EN.md)
+ - [Web](web/Readme-EN.md)
- [Notification](notification/Readme-EN.md)
- [Window Manager](windowmanager/Readme-EN.md)
- [WebGL](webgl/Readme-EN.md)
@@ -81,8 +113,10 @@
- [ArkTS and JS APIs](reference/apis/Readme-EN.md)
- [Error Codes](reference/errorcodes/Readme-EN.md)
- Native APIs
+ - [Native APIs](reference/native-apis/Readme-EN.md)
- [Standard Libraries](reference/native-lib/third_party_libc/musl.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md)
- [FAQs](faqs/Readme-EN.md)
- Contribution
- [How to Contribute](../contribute/documentation-contribution.md)
+
\ No newline at end of file
diff --git a/en/application-dev/database/Readme-EN.md b/en/application-dev/database/Readme-EN.md
index b397b5b38682c9910724ea70e4759fe9a9aaf06e..77e1d8f9738d949ce9b0f0396bf66f99b9bf924e 100644
--- a/en/application-dev/database/Readme-EN.md
+++ b/en/application-dev/database/Readme-EN.md
@@ -5,7 +5,7 @@
- [Overview of Application Data Persistence](app-data-persistence-overview.md)
- [Persisting Preferences Data](data-persistence-by-preferences.md)
- [Persisting KV Store Data](data-persistence-by-kv-store.md)
- - [Persisting RDB Store Data] (data-persistence-by-rdb-store.md)
+ - [Persisting RDB Store Data](data-persistence-by-rdb-store.md)
- Distributed Application Data Synchronization
- [Distributed Application Data Synchronization Overview](sync-app-data-across-devices-overview.md)
- [Cross-Device Synchronization of KV Stores](data-sync-of-kv-store.md)
@@ -16,7 +16,7 @@
- [Database Backup and Restoration](data-backup-and-restore.md)
- [Database Encryption](data-encryption.md)
- [Access Control by Device and Data Level](access-control-by-device-and-data-level.md)
-- Cross-Application Data Sharing (Available Only for System Applications)
+- Cross-Application Data Sharing (for System Applications Only)
- [Cross-Application Data Sharing Overview](share-device-data-across-apps-overview.md)
- [Sharing Data Using DataShareExtensionAbility](share-data-by-datashareextensionability.md)
- [Sharing Data in Silent Access](share-data-by-silent-access.md)
diff --git a/en/application-dev/database/data-sync-of-kv-store.md b/en/application-dev/database/data-sync-of-kv-store.md
index f6b2d2c55dca745843d55d37bc3a96166bc3e4ff..a32e605f9c358e83b47660d12a32eeb29d677851 100644
--- a/en/application-dev/database/data-sync-of-kv-store.md
+++ b/en/application-dev/database/data-sync-of-kv-store.md
@@ -68,7 +68,7 @@ When data is added, deleted, or modified, a notification is sent to the subscrib
- The KV stores do not support custom conflict resolution policies for applications.
-- A maximum of 16 distributed KV stores can be opened simultaneously for an application.
+- A maximum of 16 KV stores can be opened simultaneously for an application.
- Each KV store supports a maximum of eight callbacks for subscription of data change notifications.
diff --git a/en/application-dev/dfx/errormanager-guidelines.md b/en/application-dev/dfx/errormanager-guidelines.md
index 4679cfcfc78893590fe73eab770e49fc68a1a828..8509fff09e51cd31665e80fab6dce0f2472ab08d 100644
--- a/en/application-dev/dfx/errormanager-guidelines.md
+++ b/en/application-dev/dfx/errormanager-guidelines.md
@@ -23,7 +23,8 @@ When an asynchronous callback is used, the return value can be processed directl
| API | Description |
| ------------------------------ | ------------------------------------------------------------ |
-| onUnhandledException(errMsg: string): void | Called when an application generates an uncaught exception after being registered.|
+| onUnhandledException(errMsg: string): void | Called when an uncaught exception is reported after the application is registered.|
+| onException?(errObject: Error): void | Called when an application exception is reported to the JavaScript layer after the application is registered.|
### Result Codes for Unregistering an Observer
@@ -43,6 +44,13 @@ let registerId = -1;
let callback = {
onUnhandledException: function (errMsg) {
console.log(errMsg);
+ },
+ onException: function (errorObj) {
+ console.log('onException, name: ', errorObj.name);
+ console.log('onException, message: ', errorObj.message);
+ if (typeof(errorObj.stack) === 'string') {
+ console.log('onException, stack: ', errorObj.stack);
+ }
}
}
diff --git a/en/application-dev/file-management/Readme-EN.md b/en/application-dev/file-management/Readme-EN.md
index 1e644dbac0ff2cf0e9f9deb205d234abc716ac08..bdc1bc7c1b00195bc24c71396f4fed78b93de15a 100644
--- a/en/application-dev/file-management/Readme-EN.md
+++ b/en/application-dev/file-management/Readme-EN.md
@@ -1,4 +1,4 @@
-# File
+# File Management
- [File Management Overview](file-management-overview.md)
- Application File
@@ -20,4 +20,4 @@
- Distributed File System
- [Distributed File System Overview](distributed-fs-overview.md)
- [Setting the Security Level of a Distributed File](set-security-label.md)
- - [Access Files Across Devices](file-access-across-devices.md)
+ - [Accessing Files Across Devices](file-access-across-devices.md)
diff --git a/en/application-dev/file-management/app-sandbox-directory.md b/en/application-dev/file-management/app-sandbox-directory.md
index 7d06b330aa085aa34045c5491b5855160744f44a..3424dfbc9ec457e5ab6839e521fde5caad0dd3ae 100644
--- a/en/application-dev/file-management/app-sandbox-directory.md
+++ b/en/application-dev/file-management/app-sandbox-directory.md
@@ -73,7 +73,7 @@ The following figure shows the application file directories. The path of a file
| distributedfiles | distributedFilesDir | Distributed file directory| Directory in **el2** for saving the application files that can be directly accessed across devices. This directory is cleared when the application is uninstalled.|
| files | filesDir | Application file directory| Directory for saving the application's persistent files on the device. This directory is cleared when the application is uninstalled.|
| cache | cacheDir | Application cache file directory| Directory for caching the downloaded files of the application or saving the cache files regenerated on the device. This directory is automatically cleared when the size of the **cache** directory reaches the quota or the system storage space reaches a certain threshold. The user can also clear this directory by using a system space management application. The application needs to check whether the file still exists and determine whether to cache the file again.|
- | preferences | preferencesDir | Preferences file directory| Directory for saving common application configuration and user preference data managed by using database APIs. This directory is cleared when the application is uninstalled. For details, see [Data Persistence by User Preferences](../database/data-persistence-by-preferences.md).|
+ | preferences | preferencesDir | Preferences file directory| Directory for saving common application configuration and user preference data managed by using database APIs. This directory is cleared when the application is uninstalled. For details, see [Persisting Preferences Data](../database/data-persistence-by-preferences.md).|
| temp | tempDir | Temporary file directory| Directory for saving the files generated and required during the application's runtime on the device. This directory is cleared when the application exits.|
The application file paths are used in the following scenarios:
@@ -92,5 +92,3 @@ The following figure shows the application file directories. The path of a file
Used to store application preferences data, including preference files and configuration files. This directory applied to storing only a small amount of data.
- Temporary file directory
Used to store temporarily generated data of an application, including cached database data and images, temporary log files, downloaded application installation package files. The data stored in this directory is deleted after being used.
-
-
\ No newline at end of file
diff --git a/en/application-dev/file-management/file-access-across-devices.md b/en/application-dev/file-management/file-access-across-devices.md
index 434af1a2920a9f9144dfa6e29bcf57edbd57bd93..840078f5f982d55a9d9a3713fafa49d632d352f8 100644
--- a/en/application-dev/file-management/file-access-across-devices.md
+++ b/en/application-dev/file-management/file-access-across-devices.md
@@ -1,4 +1,4 @@
-# Access Files Across Devices
+# Accessing Files Across Devices
The distributed file system provides cross-device file access capabilities for applications. For the same application installed on multiple devices, you can implement read and write of the files in the application's distributed directory (**/data/storage/el2/distributedfiles/**) across devices by using [ohos.file.fs](app-file-access.md). For example, device A and device B are installed with the same application. After device A and device B are connected to form a Virtual Device, the application on device A can access the files of the same application on Device B. What you need to do is place the files to the distributed directory.
diff --git a/en/application-dev/file-management/file-management-overview.md b/en/application-dev/file-management/file-management-overview.md
index a159a3348eb7892a68a334c64ae0b69288e24d1d..2fbd4b4a036de1f20f8aa64825ab1dcb60f23414 100644
--- a/en/application-dev/file-management/file-management-overview.md
+++ b/en/application-dev/file-management/file-management-overview.md
@@ -23,6 +23,3 @@ The file systems can be classified into the following types based on the file st
**Figure 1** Files in an OS

-
-
-
\ No newline at end of file
diff --git a/en/application-dev/file-management/set-security-label.md b/en/application-dev/file-management/set-security-label.md
index 94ad527767e443b532330e207a45653980cdfa71..af819fba397d47f81b0ebe005e67f9e6c8ebef39 100644
--- a/en/application-dev/file-management/set-security-label.md
+++ b/en/application-dev/file-management/set-security-label.md
@@ -1,6 +1,6 @@
# Setting the Security Level of a Distributed File
-The security capabilities vary with devices. For example, small embedded devices provide fewer security capabilities than tablets. The security requirements also vary with data. For example, personal health information and bank card information are not expected to be accessed by devices of lower security levels. OpenHarmony provides a complete set of standards for data and device classification and custom data transfer policies for different devices. For details, see [Data and Device Security Classification](../database/access-control-by-device-and-data-level.md).
+The security capabilities vary with devices. For example, small embedded devices provide fewer security capabilities than tablets. The security requirements also vary with data. For example, personal health information and bank card information are not expected to be accessed by devices of lower security levels. OpenHarmony provides a complete set of standards for data and device classification and custom data transfer policies for different devices. For details, see [Data Security Labels and Device Security Levels](../database/access-control-by-device-and-data-level.md).
## Available APIs
@@ -39,4 +39,3 @@ securityLabel.setSecurityLabel(filePath, 's0').then(() => {
console.error(`Failed to setSecurityLabel. Code: ${err.code}, message: ${err.message}`);
});
```
-
\ No newline at end of file
diff --git a/en/application-dev/media/Readme-EN.md b/en/application-dev/media/Readme-EN.md
index f3a233ca129527db112459ab5110df49b8e1052d..efc78832291fda395506dc0864af4fae0f068621 100755
--- a/en/application-dev/media/Readme-EN.md
+++ b/en/application-dev/media/Readme-EN.md
@@ -45,11 +45,11 @@
- [Session Management](camera-session-management.md)
- [Camera Preview](camera-preview.md)
- [Camera Photographing](camera-shooting.md)
- - [Video Recording](camera-recording.md)
+ - [Camera Recording](camera-recording.md)
- [Camera Metadata](camera-metadata.md)
- Best Practices
- [Camera Photographing Sample](camera-shooting-case.md)
- - [Video Recording Sample](camera-recording-case.md)
+ - [Camera Recording Sample](camera-recording-case.md)
- Image
- [Image Overview](image-overview.md)
- [Image Decoding](image-decoding.md)
diff --git a/en/application-dev/media/camera-recording-case.md b/en/application-dev/media/camera-recording-case.md
index 4d284f7e675fe0693240bbb678391147926652e7..7aedbf5688812c47542ee627329b137325f17bbc 100644
--- a/en/application-dev/media/camera-recording-case.md
+++ b/en/application-dev/media/camera-recording-case.md
@@ -1,4 +1,4 @@
-# Video Recording Sample
+# Camera Recording Sample
## Development Process
diff --git a/en/application-dev/media/camera-recording.md b/en/application-dev/media/camera-recording.md
index 421ff990bf45b372dd39cd3346e29b636f292762..208b0664204ef2f74bb1160702053bde61fdf316 100644
--- a/en/application-dev/media/camera-recording.md
+++ b/en/application-dev/media/camera-recording.md
@@ -1,4 +1,4 @@
-# Video Recording
+# Camera Recording
Video recording is also an important function of the camera application. Video recording is the process of cyclic capturing of frames. To smooth videos, you can follow step 4 in [Camera Photographing](camera-shooting.md) to set the resolution, flash, focal length, photo quality, and rotation angle.
diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md
index 16ca26e360b85d5f7b1e73b91882c1f839fecd04..d4984c913c6513270302417d873cf25d8ba2e60e 100644
--- a/en/application-dev/reference/apis/Readme-EN.md
+++ b/en/application-dev/reference/apis/Readme-EN.md
@@ -237,7 +237,7 @@
- [@ohos.file.environment (Directory Environment Capability)](js-apis-file-environment.md)
- [@ohos.file.fileAccess (User File Access and Management)](js-apis-fileAccess.md)
- [@ohos.file.fileExtensionInfo (User File Extension Information)](js-apis-fileExtensionInfo.md)
- - [@ohos.file.fileUri (File URI)](js-apis-file-fileUri.md)
+ - [@ohos.file.fileuri (File URI)](js-apis-file-fileuri.md)
- [@ohos.file.fs (File Management)](js-apis-file-fs.md)
- [@ohos.file.hash (File Hash Processing)](js-apis-file-hash.md)
- [@ohos.file.picker (File Picker)](js-apis-file-picker.md)
diff --git a/en/application-dev/reference/apis/js-apis-distributedKVStore.md b/en/application-dev/reference/apis/js-apis-distributedKVStore.md
index 2db407ff033f6f64ae96c71e8228d770f1242ed4..d1911570c6460214f6d814583359a889dd75d8c8 100644
--- a/en/application-dev/reference/apis/js-apis-distributedKVStore.md
+++ b/en/application-dev/reference/apis/js-apis-distributedKVStore.md
@@ -23,7 +23,7 @@ import distributedKVStore from '@ohos.data.distributedKVStore';
## KVManagerConfig
-Defines the **KVManager** instance configuration, including the bundle name of the invoker and the application context.
+Provides the **KVManager** instance configuration, including the bundle name of the invoker and the application context.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
@@ -127,7 +127,7 @@ Enumerates the distributed KV store types.
| Name | Description |
| -------------------- | ------------------------------------------------------------ |
-| DEVICE_COLLABORATION | Device KV store. The device KV store manages data by device, which eliminates conflicts. Data can be queried by device. **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore |
+| DEVICE_COLLABORATION | Device KV store. The device KV store manages data by device, which eliminates conflicts. Data can be queried by device. **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore|
| SINGLE_VERSION | Single KV store. The single KV store does not differentiate data by device. If entries with the same key are modified on different devices, the value will be overwritten. **System capability**: SystemCapability.DistributedDataManager.KVStore.Core |
## SecurityLevel
@@ -136,7 +136,7 @@ Enumerates the KV store security levels.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
-| Name | Description |
+| Name | Description |
| ---: | ------------------------------------------------------------ |
| S1 | Low security level. Disclosure, tampering, corruption, or loss of the data may cause minor impact on an individual or group. Examples: gender and nationality information, and user application records |
| S2 | Medium security level. Disclosure, tampering, corruption, or loss of the data may cause major impact on an individual or group. Examples: mailing addresses and nicknames of individuals |
@@ -2028,7 +2028,7 @@ try {
deviceId(deviceId:string):Query
Creates a **Query** object with the device ID as the key prefix.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -2817,7 +2817,7 @@ try {
removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void
Deletes data of a device. This API uses an asynchronous callback to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -2869,7 +2869,7 @@ try {
removeDeviceData(deviceId: string): Promise<void>
Deletes data of a device. This API uses a promise to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -4548,7 +4548,7 @@ try {
sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void
Synchronizes the KV store manually. For details about the synchronization modes of KV stores, see [Cross-Device Synchronization of KV Stores](../../database/data-sync-of-kv-store.md).
-> **NOTE**
+> **NOTE**
>
> The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
@@ -4617,7 +4617,7 @@ deviceManager.createDeviceManager('bundleName', (err, value) => {
sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void
Synchronizes the KV store manually. This API returns the result synchronously. For details about the synchronization modes of KV stores, see [Cross-Device Synchronization of KV Stores](../../database/data-sync-of-kv-store.md).
-> **NOTE**
+> **NOTE**
>
> The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
@@ -4735,7 +4735,7 @@ Subscribes to synchronization complete events.
| Name | Type | Mandatory| Description |
| ------------ | --------------------------------------------- | ---- | ------------------------------------------------------ |
| event | string | Yes | Event to subscribe to. The value is **syncComplete**, which indicates a synchronization complete event.|
-| syncCallback | Callback<Array<[string, number]>> | Yes | Callback invoked to return the synchronization complete event. |
+| syncCallback | Callback<Array<[string, number]>> | Yes | Callback invoked to return the synchronization complete event.|
**Example**
@@ -4769,7 +4769,7 @@ Unsubscribes from data changes.
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- | -------------------------------------------------------- |
| event | string | Yes | Event to unsubscribe from. The value is **dataChange**, which indicates a data change event.|
-| listener | Callback<[ChangeNotification](#changenotification)> | No | Callback for data changes. |
+| listener | Callback<[ChangeNotification](#changenotification)> | No | Callback for the data change event. |
**Error codes**
@@ -5044,7 +5044,7 @@ try {
get(deviceId: string, key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void
Obtains a string value that matches the specified device ID and key. This API uses an asynchronous callback to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -5099,7 +5099,7 @@ try {
get(deviceId: string, key: string): Promise<boolean | string | number | Uint8Array>
Obtains a string value that matches the specified device ID and key. This API uses a promise to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -5279,7 +5279,7 @@ try {
getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry[]>): void
Obtains all KV pairs that match the specified device ID and key prefix. This API uses an asynchronous callback to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -5346,7 +5346,7 @@ try {
getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>
Obtains all KV pairs that match the specified device ID and key prefix. This API uses a promise to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -5542,7 +5542,7 @@ try {
getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>): void
Obtains the KV pairs that match the specified device ID and **Query** object. This API uses an asynchronous callback to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -5614,7 +5614,7 @@ try {
getEntries(deviceId: string, query: Query): Promise<Entry[]>
Obtains the KV pairs that match the specified device ID and **Query** object. This API uses a promise to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -5822,7 +5822,7 @@ try {
getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void
Obtains a **KVStoreResultSet** object that matches the specified device ID and key prefix. This API uses an asynchronous callback to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -5877,7 +5877,7 @@ try {
getResultSet(deviceId: string, keyPrefix: string): Promise<KVStoreResultSet>
Obtains a **KVStoreResultSet** object that matches the specified device ID and key prefix. This API uses a promise to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -5933,7 +5933,7 @@ try {
getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KVStoreResultSet>): void
Obtains a **KVStoreResultSet** object that matches the specified device ID and **Query** object. This API uses an asynchronous callback to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -6009,7 +6009,7 @@ try {
getResultSet(deviceId: string, query: Query): Promise<KVStoreResultSet>
Obtains a **KVStoreResultSet** object that matches the specified device ID and **Query** object. This API uses a promise to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -6152,7 +6152,7 @@ try {
getResultSet(query: Query, callback:AsyncCallback<KVStoreResultSet>): void
Obtains a **KVStoreResultSet** object that matches the specified **Query** object for this device. This API uses an asynchronous callback to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -6341,7 +6341,7 @@ try {
getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<KVStoreResultSet>): void
Obtains a **KVStoreResultSet** object that matches the specified predicate object and device ID. This API uses an asynchronous callback to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -6402,7 +6402,7 @@ try {
getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>
Obtains a **KVStoreResultSet** object that matches the specified predicate object and device ID. This API uses a promise to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -6583,7 +6583,7 @@ try {
getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number>): void;
Obtains the number of results that matches the specified device ID and **Query** object. This API uses an asynchronous callback to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -6650,7 +6650,7 @@ try {
getResultSize(deviceId: string, query: Query): Promise<number>
Obtains the number of results that matches the specified device ID and **Query** object. This API uses a promise to return the result.
-> **NOTE**
+> **NOTE**
>
> **deviceId** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
> For details about how to obtain **deviceId**, see [sync()](#sync).
@@ -6712,4 +6712,3 @@ try {
console.error(`Failed to get resultSize.code is ${e.code},message is ${e.message}`);
}
```
-
\ No newline at end of file
diff --git a/en/application-dev/reference/apis/js-apis-file-fileUri.md b/en/application-dev/reference/apis/js-apis-file-fileuri.md
similarity index 100%
rename from en/application-dev/reference/apis/js-apis-file-fileUri.md
rename to en/application-dev/reference/apis/js-apis-file-fileuri.md
diff --git a/en/application-dev/reference/apis/js-apis-uripermissionmanager.md b/en/application-dev/reference/apis/js-apis-uripermissionmanager.md
new file mode 100644
index 0000000000000000000000000000000000000000..638fe99e48efc36559d81b9b53b16293500c64c3
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-uripermissionmanager.md
@@ -0,0 +1,143 @@
+# @ohos.application.uriPermissionManager (URI Permission Management)
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+The **uriPermissionManager** module provides APIs for granting permissions on a file to or revoking the granted permission from an application. The file is identified by a uniform resource identifier (URI).
+
+
+## Modules to Import
+
+
+```js
+import UriPermissionManager from '@ohos.application.uriPermissionManager';
+```
+
+
+## uriPermissionManager.grantUriPermission
+
+grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number, callback: AsyncCallback<number>): void
+
+Grants permission on the file of the specified URI to an application. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | uri | string | Yes| URI of the file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
+ | flag | [wantConstant.Flags](js-apis-ability-wantConstant.md#wantconstantflags) | Yes| Read or write permission on the file to grant.|
+ | targetBundleName | string | Yes| Bundle name of the application, to which the permission is granted.|
+ | callback | AsyncCallback<number> | Yes| Callback invoked to return the result. If the operation is successful, **0** is returned; otherwise, **-1** is returned.|
+
+**Example**
+
+ ```js
+ import WantConstant from '@ohos.ability.wantConstant';
+ let targetBundleName = 'com.example.test_case1'
+ let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10"
+ uriPermissionManager.grantUriPermission(uri, WantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, targetBundleName, (result) => {
+ console.log("result.code = " + result.code)
+ })
+ ```
+
+
+## uriPermissionManager.grantUriPermission
+
+grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise<number>
+
+Grants permission on the file of the specified URI to an application. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | uri | string | Yes| URI of the file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
+ | flag | [wantConstant.Flags](js-apis-ability-wantConstant.md#wantconstantflags) | Yes| Read or write permission on the file to grant.|
+ | targetBundleName | string | Yes| Bundle name of the application, to which the permission is granted.|
+
+**Return value**
+
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<number> | Promise used to return the result. If the operation is successful, **0** is returned; otherwise, **-1** is returned.|
+
+**Example**
+
+ ```js
+ import WantConstant from '@ohos.ability.wantConstant';
+ let targetBundleName = 'com.example.test_case1'
+ let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10"
+ uriPermissionManager.grantUriPermission(uri, wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, targetBundleName)
+ .then((data) => {
+ console.log('Verification succeeded.' + data)
+ }).catch((error) => {
+ console.log('Verification failed.');
+ })
+ ```
+## uriPermissionManager.revokeUriPermission
+
+revokeUriPermission(uri: string, accessTokenId: number, callback: AsyncCallback<number>): void
+
+Revokes the permission on the file of the specified URI from an application. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | uri | string | Yes| URI of the file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
+ | targetBundleName | string | Yes| Bundle name of the application, from which the permission is revoked.|
+ | callback | AsyncCallback<number> | Yes| Callback invoked to return the result. If the operation is successful, **0** is returned; otherwise, **-1** is returned.|
+
+**Example**
+
+ ```js
+ import WantConstant from '@ohos.ability.wantConstant';
+ let targetBundleName = 'com.example.test_case1'
+ let URI = "fileshare:///com.samples.filesharetest.FileShare/person/10"
+ uriPermissionManager.revokeUriPermission(uri, targetBundleName, (result) => {
+ console.log("result.code = " + result.code)
+ })
+ ```
+
+
+## uriPermissionManager.revokeUriPermission
+
+revokeUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise<number>
+
+Revokes the permission on the file of the specified URI from an application. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | uri | string | Yes| URI of the file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
+ | targetBundleName | string | Yes| Bundle name of the application, from which the permission is revoked.|
+
+**Return value**
+
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<number> | Promise used to return the result. If the operation is successful, **0** is returned; otherwise, **-1** is returned.|
+
+**Example**
+
+ ```js
+ import WantConstant from '@ohos.ability.wantConstant';
+ let targetBundleName = 'com.example.test_case1'
+ let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10"
+ uriPermissionManager.revokeUriPermission(uri, targetBundleName)
+ .then((data) => {
+ console.log('Verification succeeded.' + data)
+ }).catch((error) => {
+ console.log('Verification failed.');
+ })
+ ```
diff --git a/en/application-dev/security/permission-list.md b/en/application-dev/security/permission-list.md
index fc3d8593e3bfcf75888d985d69c556db2dbe15b4..f598c23376424ab5dbcb99e99691584ce444dc7d 100644
--- a/en/application-dev/security/permission-list.md
+++ b/en/application-dev/security/permission-list.md
@@ -436,7 +436,7 @@ Allows an application to obtain the sensitive permissions that have been granted
## ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
-Allows an application to set attributes for the applications of other users.
+Allows an application to set the attributes of applications of other users.
**Permission level**: system_core
@@ -496,7 +496,7 @@ Allows an application to read data from a gyroscope sensor or uncalibrated gyros
## ohos.permission.INSTALL_BUNDLE
-Allows an application to install and uninstall other applications.
+Allows an application to install and uninstall other applications (except enterprise InHouse applications).
**Permission level**: system_core
@@ -974,6 +974,26 @@ Allows the device administrator to set bundle installation policies.
**Enable via ACL**: TRUE
+## ohos.permission.ENTERPRISE_SET_NETWORK
+
+Allows the device administrator application to set network information.
+
+**Permission level**: system_basic
+
+**Authorization mode**: system_grant
+
+**Enable via ACL**: TRUE
+
+## ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+Allows the device administrator application to set application running policies.
+
+**Permission level**: system_basic
+
+**Authorization mode**: system_grant
+
+**Enable via ACL**: TRUE
+
## ohos.permission.NFC_TAG
Allows an application to read NFC tag information.
@@ -1146,7 +1166,7 @@ Allows an application to add, remove, and modify call logs.
## ohos.permission.WRITE_CONTACTS
-Allows an application to add, remove, and modify contacts.
+Allows an application to add, remove, and modify Contacts.
**Permission level**: system_basic
@@ -1500,7 +1520,7 @@ Allows an application to manage private credentials and query certificate status
## ohos.permission.ACCESS_PUSH_SERVICE
-Allows an application to to access the Ability of the push service.
+Allows an application to access the Ability of the push service.
**Permission level**: system_basic
@@ -1628,6 +1648,26 @@ Allows an application to have backup and restore capabilities.
**Enable via ACL**: TRUE
+## ohos.permission.CLOUDFILE_SYNC_MANAGER
+
+Allows an application to obtain the device-cloud synchronization management capability.
+
+**Permission level**: system_basic
+
+**Authorization mode**: system_grant
+
+**Enable via ACL**: TRUE
+
+## ohos.permission.CLOUDFILE_SYNC
+
+Allows an application to perform device-cloud synchronization.
+
+**Permission level**: system_basic
+
+**Authorization mode**: system_grant
+
+**Enable via ACL**: TRUE
+
## ohos.permission.FILE_ACCESS_MANAGER
Allows a file management application to access user data files through the FAF.
@@ -1640,7 +1680,7 @@ Allows a file management application to access user data files through the FAF.
## ohos.permission.MANAGE_AUDIO_CONFIG
-Allows an application to to mute microphones globally.
+Allows an application to mute microphones globally.
**Permission level**: system_basic
@@ -1757,3 +1797,83 @@ Allows an application to use ultrasonic sensing.
**Authorization mode**: system_grant
**Enable ACL**: FALSE
+
+## ohos.permission.INSTALL_ENTERPRISE_BUNDLE
+
+Allows an application to install and uninstall enterprise InHouse applications.
+
+**Permission level**: system_core
+
+**Authorization mode**: system_grant
+
+**Enable via ACL**: TRUE
+
+## ohos.permission.PROXY_AUTHORIZATION_URI
+
+Allows the application proxy to authorize the URI.
+
+**Permission level**: system_basic
+
+**Authorization mode**: system_grant
+
+**Enable ACL**: FALSE
+
+## ohos.permission.GET_INSTALLED_BUNDLE_LIST
+
+Allows an application to obtain the list of installed applications.
+
+**Permission level**: system_basic
+
+**Authorization mode**: user_grant
+
+**Enable via ACL**: TRUE
+
+## ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS
+
+Allows an application to manage distributed account information.
+
+**Permission level**: system_basic
+
+**Authorization mode**: system_grant
+
+**Enable via ACL**: TRUE
+
+## ohos.permission.GET_DISTRIBUTED_ACCOUNTS
+
+Allows an application to obtain distributed account information.
+
+**Permission level**: system_basic
+
+**Authorization mode**: system_grant
+
+**Enable via ACL**: TRUE
+
+## ohos.permission.GET_LOCAL_ACCOUNTS
+
+Allows an application to obtain local account information.
+
+**Permission level**: system_basic
+
+**Authorization mode**: system_grant
+
+**Enable via ACL**: TRUE
+
+## ohos.permission.READ_HIVIEW_SYSTEM
+
+Allows an application to access HiView data.
+
+**Permission level**: system_basic
+
+**Authorization mode**: system_grant
+
+**Enable via ACL**: TRUE
+
+## ohos.permission.WRITE_HIVIEW_SYSTEM
+
+Allows an application to modify HiView data.
+
+**Permission level**: system_basic
+
+**Authorization mode**: system_grant
+
+**Enable via ACL**: TRUE
diff --git a/en/application-dev/ui/ui-js-building-ui-component.md b/en/application-dev/ui/ui-js-building-ui-component.md
index 752b8c4e4d527c9ffa0357fa9474aa1430bca6d9..71099ca5fe3206d7531d328c364e4163436fd50b 100644
--- a/en/application-dev/ui/ui-js-building-ui-component.md
+++ b/en/application-dev/ui/ui-js-building-ui-component.md
@@ -11,26 +11,11 @@ You can also customize a new component through proper combination of components
Components can be classified into the following types based on their functions.
-| Type | Components |
-| -------- | -------- |
+| Type | Components |
+| --------- | ---------------------------------------- |
| Container | badge, dialog, div, form, list, list-item, list-item-group, panel, popup, refresh, stack, stepper, stepper-item, swiper, tabs, tab-bar, tab-content |
-| Basic | button, chart, divider, image, image-animator, input, label, marquee, menu, option, picker, picker-view, piece, progress, qrcode, rating, richtext, search, select, slider, span, switch, text, textarea, toolbar, toolbar-item, toggle |
-| Media | video |
-| Canvas | canvas |
-| Grid | grid-container, grid-row, grid-col |
-| SVG | svg, rect, circle, ellipse, path, line, polyline, polygon, text, tspan, textPath, animate, animateMotion, animateTransform |
-## Samples
-
-The following samples are provided to help you better understand how to develop components:
-
-- [`JsPanel`: Content Display Panel (JavaScript, API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/JsPanel)
-- [`Popup`: JavaScript Bubble (API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/Popup)
-- [`RefreshContainer`: Refresh Container (JavaScript, API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/RefreshContainer)
-- [`JSComponments`: JavaScript Bubble (API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/JSComponments)
-- [`JsUserRegistration`: User Registration (JavaScript, API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/JsUserRegistration)
-- [`ECG`: Heart Rate Detection (JavaScript, API 7)](https://gitee.com/openharmony/app_samples/tree/master/common/ECG)
-
-- [`Badge`: Badge (JavaScript, API 8)](https://gitee.com/openharmony/app_samples/tree/master/UI/Badge)
-- [`JsVideo`: JsVideo (API 8)](https://gitee.com/openharmony/app_samples/tree/master/media/JsVideo)
-- [Rating (JavaScript)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/RatingApplication)
-- [Simple Video Player](https://gitee.com/openharmony/codelabs/tree/master/Media/VideoOpenHarmony)
+| Basic | button, chart, divider, image, image-animator, input, label, marquee, menu, option, picker, picker-view, piece, progress, qrcode, rating, richtext, search, select, slider, span, switch, text, textarea, toolbar, toolbar-item, toggle |
+| Media | video |
+| Canvas | canvas |
+| Grid | grid-container, grid-row, grid-col |
+| SVG | svg, rect, circle, ellipse, path, line, polyline, polygon, text, tspan, textPath, animate, animateMotion, animateTransform |
\ No newline at end of file
diff --git a/en/application-dev/web/Readme-EN.md b/en/application-dev/web/Readme-EN.md
new file mode 100644
index 0000000000000000000000000000000000000000..e003a42ecdbe48166e7603ea1e879739010e8228
--- /dev/null
+++ b/en/application-dev/web/Readme-EN.md
@@ -0,0 +1,17 @@
+# Web
+
+- [Web Component Overview](web-component-overview.md)
+- [Loading Pages by Using the Web Component](web-page-loading-with-web-components.md)
+- Setting Basic Attributes and Events
+ - [Setting the Dark Mode](web-set-dark-mode.md)
+ - [Uploading Files](web-file-upload.md)
+ - [Opening Pages in a New Window](web-open-in-new-window.md)
+ - [Managing Location Permissions](web-geolocation-permission.md)
+- Using Frontend Page JavaScript Code on the Application
+ - [Invoking Frontend Page Functions on the Application](web-in-app-frontend-page-function-invoking.md)
+ - [Invoking Application Functions on the Frontend Page](web-in-page-app-function-invoking.md)
+ - [Establishing a Data Channel Between the Application and Frontend Page](web-app-page-data-channel.md)
+- [Managing Page Redirection and Browsing History Navigation](web-redirection-and-browsing-history-mgmt.md)
+- [Managing Cookies and Data Storage](web-cookie-and-data-storage-mgmt.md)
+- [Customizing Page Request Responses](web-resource-interception-request-mgmt.md)
+- [Debugging Frontend Pages by Using DevTools](web-debugging-with-devtools.md)
diff --git a/en/application-dev/web/figures/debug-effect.png b/en/application-dev/web/figures/debug-effect.png
new file mode 100644
index 0000000000000000000000000000000000000000..32c46cadbb99a6623532f50d14fa0750854c9a5d
Binary files /dev/null and b/en/application-dev/web/figures/debug-effect.png differ
diff --git a/en/application-dev/web/figures/resource-path.png b/en/application-dev/web/figures/resource-path.png
new file mode 100644
index 0000000000000000000000000000000000000000..602c750894581e13296cb7cb77e9714f143983f9
Binary files /dev/null and b/en/application-dev/web/figures/resource-path.png differ
diff --git a/en/application-dev/web/web-app-page-data-channel.md b/en/application-dev/web/web-app-page-data-channel.md
new file mode 100644
index 0000000000000000000000000000000000000000..f26c635fdf294c9237342381355538da950ad281
--- /dev/null
+++ b/en/application-dev/web/web-app-page-data-channel.md
@@ -0,0 +1,143 @@
+# Establishing a Data Channel Between the Application and the Frontend Page
+
+
+The [createWebMessagePorts()](../reference/apis/js-apis-webview.md#createwebmessageports) API allows you to create message ports to implement communication between the application and frontend page.
+
+
+In the following example, **createWebMessagePorts** is used to create message ports on the application and [postMessage()](../reference/apis/js-apis-webview.md#postmessage) is used to forward one of the message ports to the frontend page so that the application and frontend page can exchange messages with each other over the port.
+
+
+- Application code:
+
+ ```ts
+ // xxx.ets
+ import web_webview from '@ohos.web.webview';
+
+ @Entry
+ @Component
+ struct WebComponent {
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+ ports: web_webview.WebMessagePort[];
+ @State sendFromEts: string = 'Send this message from ets to HTML';
+ @State receivedFromHtml: string = 'Display received message send from HTML';
+
+ build() {
+ Column() {
+ // Display the content received from the HTML side.
+ Text(this.receivedFromHtml)
+ // Send the content in the text box to the HTML side.
+ TextInput({placeholder: 'Send this message from ets to HTML'})
+ .onChange((value: string) => {
+ this.sendFromEts = value;
+ })
+
+ Button('postMessage')
+ .onClick(() => {
+ try {
+ // 1. Create two message ports.
+ this.ports = this.controller.createWebMessagePorts();
+ // 2. Register a callback for the message port (for example, port 1) on the application.
+ this.ports[1].onMessageEvent((result: web_webview.WebMessage) => {
+ let msg = 'Got msg from HTML:';
+ if (typeof(result) === 'string') {
+ console.info(`received string message from html5, string is: ${result}`);
+ msg = msg + result;
+ } else if (typeof(result) === 'object') {
+ if (result instanceof ArrayBuffer) {
+ console.info(`received arraybuffer from html5, length is: ${result.byteLength}`);
+ msg = msg + 'lenght is ' + result.byteLength;
+ } else {
+ console.info('not support');
+ }
+ } else {
+ console.info('not support');
+ }
+ this.receivedFromHtml = msg;
+ })
+ // 3. Send the other message port (for example, port 0) to the HTML side, which then saves the message port.
+ this.controller.postMessage('__init_port__', [this.ports[0]], '*');
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+
+ // 4. Use the message port on the application to send messages to the message port that has been sent to the HTML side.
+ Button('SendDataToHTML')
+ .onClick(() => {
+ try {
+ if (this.ports && this.ports[1]) {
+ this.ports[1].postMessageEvent(this.sendFromEts);
+ } else {
+ console.error(`ports is null, Please initialize first`);
+ }
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ Web({ src: $rawfile('xxx.html'), controller: this.controller })
+ }
+ }
+ }
+ ```
+
+- Frontend page code:
+
+ ```html
+
+
+
+
+
+ WebView Message Port Demo
+
+
+
+
+
+ WebView Message Port Demo
+
+
+
+
+ display received message send from ets
+
+
+ ```
diff --git a/en/application-dev/web/web-component-overview.md b/en/application-dev/web/web-component-overview.md
new file mode 100644
index 0000000000000000000000000000000000000000..187661ee6c6f9f98411d89c67052615e04d14bca
--- /dev/null
+++ b/en/application-dev/web/web-component-overview.md
@@ -0,0 +1,14 @@
+# Web Component Overview
+
+
+In addition to displaying web page content on applications, the **Web** component provides you with some other helpful functions, including:
+
+
+- **Page loading**: provides a full set of basic frontend page loading capabilities, which allow you to load network pages, local pages, and HTML text data.
+
+- **Page interaction**: supports a wide range of page interaction modes, which allow you to set the dark mode for frontend pages, load pages in a new window, manage location permissions and cookies, and use frontend page JavaScript code on the application.
+
+- **Page debugging**: uses DevTools to debug frontend pages.
+
+
+To help you better understand the features of the **Web** component, the following sections will exemplify use of the **Web** component in common application scenarios.
diff --git a/en/application-dev/web/web-cookie-and-data-storage-mgmt.md b/en/application-dev/web/web-cookie-and-data-storage-mgmt.md
new file mode 100644
index 0000000000000000000000000000000000000000..e5d402724d420bae4157fe18f56e9de6e00adac6
--- /dev/null
+++ b/en/application-dev/web/web-cookie-and-data-storage-mgmt.md
@@ -0,0 +1,131 @@
+# Managing Cookies and Data Storage
+
+
+## Cookie Management
+
+A cookie is a segment of data sent from the server to the client to uniquely identify a user during network access. The client may hold the data and provide it to the server at later interactions so that the server can quickly identify the client identity and status.
+
+The **Web** component provides the **WebCookieManager** class for you to manage cookie information, which is stored in the **/proc/{pid}/root/data/storage/el2/base/cache/web/Cookiesd** file in the application sandbox path.
+
+The following uses [setCookie()](../reference/apis/js-apis-webview.md#setcookie) as an example to describe how to set a cookie's value to **test** for **www.example.com**. For details about functions and usage of other APIs, see [WebCookieManager()](../reference/apis/js-apis-webview.md#webcookiemanager).
+
+
+```ts
+// xxx.ets
+import web_webview from '@ohos.web.webview';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('setCookie')
+ .onClick(() => {
+ try {
+ web_webview.WebCookieManager.setCookie('https://www.example.com', 'value=test');
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller })
+ }
+ }
+}
+```
+
+
+## Cache and Storage Management
+
+Network resource requests are relatively time-consuming during website access. You can use store resources locally by means of cache and Dom Storage to fasten the access to the same website.
+
+
+### Cache
+
+Use [cacheMode()](../reference/arkui-ts/ts-basic-components-web.md#cachemode) to configure the cache mode for page resources. Four cache modes are supported:
+
+- **Default**: Page resources in a cache that has not expired are preferentially used. If the cache does not exist, page resources are obtained from the network.
+
+- **None**: Page resources are loaded from the cache. If the cache does not exist, page resources are obtained from the network.
+
+- **Online**: Page resources are not loaded from the cache. All resources are obtained from the network.
+
+- **Only**: Page resources are only loaded from the cache.
+
+
+In the following example, the cache mode is set to **None**.
+
+
+
+```ts
+// xxx.ets
+import web_webview from '@ohos.web.webview';
+
+@Entry
+@Component
+struct WebComponent {
+ @State mode: CacheMode = CacheMode.None;
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+ build() {
+ Column() {
+ Web({ src: 'www.example.com', controller: this.controller })
+ .cacheMode(this.mode)
+ }
+ }
+}
+```
+
+
+ To obtain up-to-date resources, you can use [removeCache()](../reference/apis/js-apis-webview.md#removecache) to clear cached resources. The sample code is as follows:
+
+```ts
+// xxx.ets
+import web_webview from '@ohos.web.webview';
+
+@Entry
+@Component
+struct WebComponent {
+ @State mode: CacheMode = CacheMode.None;
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+ build() {
+ Column() {
+ Button('removeCache')
+ .onClick(() => {
+ try {
+ // If this parameter is set to true, the cache in both the ROM and RAM is cleared. If this parameter is set to false, only the cache in the RAM is cleared.
+ this.controller.removeCache(true);
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller })
+ .cacheMode(this.mode)
+ }
+ }
+}
+```
+
+
+### Dom Storage
+
+Dom Storage falls into Session Storage and Local Storage. Wherein, Session Storage applies to the temporary data, and its data storage and release follow the session lifecycle; Local Storage applies to the persistent data, which is flushed to the application directory. In both storage modes, data is stored in a form of key-value pair, and is usually used when a page that needs to be stored on the client is accessed. You can use [domStorageAccess()](../reference/arkui-ts/ts-basic-components-web.md#domstorageaccess) to enable Dom Storage. The following is the sample code:
+
+
+
+```ts
+// xxx.ets
+import web_webview from '@ohos.web.webview';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+ build() {
+ Column() {
+ Web({ src: 'www.example.com', controller: this.controller })
+ .domStorageAccess(true)
+ }
+ }
+}
+```
diff --git a/en/application-dev/web/web-debugging-with-devtools.md b/en/application-dev/web/web-debugging-with-devtools.md
new file mode 100644
index 0000000000000000000000000000000000000000..3a38a48ab12cfd740bba0d5b99cf8140d4224e4b
--- /dev/null
+++ b/en/application-dev/web/web-debugging-with-devtools.md
@@ -0,0 +1,45 @@
+# Debugging Frontend Pages by Using DevTools
+
+
+The **Web** component supports debugging of web frontend pages by using DevTools, a web frontend development and debugging tool that allows you to debug an application's frontend pages on a PC. Before you do this, use [setWebDebuggingAccess()](../reference/apis/js-apis-webview.md#setwebdebuggingaccess) to enable frontend page debugging for the **Web** component.
+
+
+To use DevTools for frontend page debugging, perform the following steps:
+
+
+1. Enable web frontend page debugging in the application code.
+
+ ```ts
+ // xxx.ets
+ import web_webview from '@ohos.web.webview';
+
+ @Entry
+ @Component
+ struct WebComponent {
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+ aboutToAppear() {
+ // Enable web frontend page debugging.
+ web_webview.WebviewController.setWebDebuggingAccess(true);
+ }
+ build() {
+ Column() {
+ Web({ src: 'www.example.com', controller: this.controller })
+ }
+ }
+ }
+ ```
+
+2. Connect your device to a PC, and configure port mapping on the PC as follows:
+
+ ```
+ // Configure port mapping.
+ hdc fport tcp:9222 tcp:9222
+ // View port mapping.
+ hdc fport ls
+ ```
+
+3. Enter **chrome://inspect/\#devices** in the address box of the Chrome browser on the PC. Once the device is identified, you can get started with page debugging. The debugging effect is as follows:
+
+ **Figure 1** Page debugging effect
+
+ 
diff --git a/en/application-dev/web/web-file-upload.md b/en/application-dev/web/web-file-upload.md
new file mode 100644
index 0000000000000000000000000000000000000000..e06f0345b2dfdbd5fd59548ed31c19bacd89f5f0
--- /dev/null
+++ b/en/application-dev/web/web-file-upload.md
@@ -0,0 +1,52 @@
+# Uploading Files
+
+
+The **Web** component supports file uploading on a frontend page. You can use [onShowFileSelector()](../reference/arkui-ts/ts-basic-components-web.md#onshowfileselector9) to process file upload requests sent from a frontend page.
+
+
+In the following example, when a user clicks the **Upload** button on the frontend page, the application receives a file upload request through [onShowFileSelector()](../reference/arkui-ts/ts-basic-components-web.md#onshowfileselector9), which carries the path of the local file to be uploaded.
+
+
+- Application code:
+
+ ```ts
+ // xxx.ets
+ import web_webview from '@ohos.web.webview';
+ @Entry
+ @Component
+ struct WebComponent {
+ controller: WebController = new WebController()
+ build() {
+ Column() {
+ // Load the local.html page.
+ Web({ src: $rawfile('local.html'), controller: this.controller })
+ .onShowFileSelector((event) => {
+ // Set the path of the local file to be uploaded.
+ let fileList: Array = [
+ 'xxx/test.png',
+ ]
+ event.result.handleFileList(fileList)
+ return true;
+ })
+ }
+ }
+ }
+ ```
+
+
+- Code of the **local.html** page:
+
+ ```html
+
+
+
+
+ Document
+
+
+
+
+
+
+
+ ```
diff --git a/en/application-dev/web/web-geolocation-permission.md b/en/application-dev/web/web-geolocation-permission.md
new file mode 100644
index 0000000000000000000000000000000000000000..0f157cccaab4e33bab16fe22ecde03fb725b2f76
--- /dev/null
+++ b/en/application-dev/web/web-geolocation-permission.md
@@ -0,0 +1,73 @@
+# Managing Location Permissions
+
+
+The **Web** component provides the location permission management capability. You can use [onGeolocationShow()](../reference/arkui-ts/ts-basic-components-web.md#ongeolocationshow) to manage the location permission specific to a website. Based on the API response, the **Web** component determines whether to grant the location permission to the frontend page. To obtain the device location, you need to declare the [ohos.permission.LOCATION](../security/accesstoken-guidelines.md) permission.
+
+
+In the following example, when a user clicks the **Get Location** button on the frontend page, the **Web** component notifies the application of the location permission request in a pop-up window.
+
+
+- Frontend page code:
+
+ ```html
+
+
+
+ Location information
+ Get Location
+
+
+
+ ```
+
+
+- Application code:
+
+ ```ts
+ // xxx.ets
+ import web_webview from '@ohos.web.webview';
+
+ @Entry
+ @Component
+ struct WebComponent {
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+ build() {
+ Column() {
+ Web({ src:$rawfile('getLocation.html'), controller:this.controller })
+ .geolocationAccess(true)
+ .onGeolocationShow((event) => { // Notification of the location permission request
+ AlertDialog.show({
+ title: 'Location Permission',
+ message:'Grant access to the device location?',
+ primaryButton: {
+ value: 'cancel',
+ action: () => {
+ event.geolocation.invoke(event.origin, false, false); // Deny access to the device location.
+ }
+ },
+ secondaryButton: {
+ value: 'ok',
+ action: () => {
+ event.geolocation.invoke(event.origin, true, false); // Allow access to the device location.
+ }
+ },
+ cancel: () => {
+ event.geolocation.invoke(event.origin, false, false); // Deny access to the device location.
+ }
+ })
+ })
+ }
+ }
+ }
+ ```
diff --git a/en/application-dev/web/web-in-app-frontend-page-function-invoking.md b/en/application-dev/web/web-in-app-frontend-page-function-invoking.md
new file mode 100644
index 0000000000000000000000000000000000000000..66e9ef25c171a346586d3294c3a9f3919a0726ab
--- /dev/null
+++ b/en/application-dev/web/web-in-app-frontend-page-function-invoking.md
@@ -0,0 +1,48 @@
+# Invoking Frontend Page Functions on the Application
+
+
+You can call [runJavaScript()](../reference/apis/js-apis-webview.md#runjavascript) on an application to call JavaScript functions of frontend pages.
+
+
+In the following example, when a user clicks the **runJavaScript** button on the application, the **htmlTest()** API of the frontend page will be triggered.
+
+
+- Frontend page code:
+
+ ```html
+
+
+
+
+
+
+
+ ```
+
+
+- Application code:
+
+ ```ts
+ // xxx.ets
+ import web_webview from '@ohos.web.webview';
+
+ @Entry
+ @Component
+ struct WebComponent {
+ webviewController: web_webview.WebviewController = new web_webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: $rawfile('index.html'), controller: this.webviewController})
+ Button('runJavaScript')
+ .onClick(() => {
+ this.webviewController.runJavaScript('htmlTest()');
+ })
+ }
+ }
+ }
+ ```
diff --git a/en/application-dev/web/web-in-page-app-function-invoking.md b/en/application-dev/web/web-in-page-app-function-invoking.md
new file mode 100644
index 0000000000000000000000000000000000000000..6ef1ed5fa8f5e5fad67e96d20189209ca51016e1
--- /dev/null
+++ b/en/application-dev/web/web-in-page-app-function-invoking.md
@@ -0,0 +1,113 @@
+# Invoking Application Functions on the Frontend Page
+
+
+You can use the **Web** component to register application code with frontend pages. After the registration is done, frontend pages can use the registered object names to call application functions.
+
+
+Two methods are available for registering the application code: Call [javaScriptProxy()](../reference/arkui-ts/ts-basic-components-web.md#javascriptproxy) during **Web** component initialization. Call [registerJavaScriptProxy()](../reference/apis/js-apis-webview.md#registerjavascriptproxy) after **Web** component initialization.
+
+
+The following example registers the **test()** function with the frontend page. This way, the **test()** function can be triggered and run on the frontend page.
+
+
+- Sample code for using [javaScriptProxy()](../reference/arkui-ts/ts-basic-components-web.md#javascriptproxy):
+
+ ```ts
+ // xxx.ets
+ import web_webview from '@ohos.web.webview';
+
+ @Entry
+ @Component
+ struct WebComponent {
+ webviewController: web_webview.WebviewController = new web_webview.WebviewController();
+ // Declare the object to be registered.
+ testObj = {
+ test: () => {
+ return 'ArkTS Hello World!';
+ }
+ }
+
+ build() {
+ Column() {
+ // Load the local index.html page.
+ Web({ src: $rawfile('index.html'), controller: this.webviewController})
+ // Inject the object to the web client.
+ .javaScriptProxy({
+ object: this.testObj,
+ name: "testObjName",
+ methodList: ["test"],
+ controller: this.webviewController
+ })
+ }
+ }
+ }
+ ```
+
+
+- Sample code for using [registerJavaScriptProxy()](../reference/apis/js-apis-webview.md#registerjavascriptproxy):
+
+ ```ts
+ // xxx.ets
+ import web_webview from '@ohos.web.webview';
+
+ @Entry
+ @Component
+ struct Index {
+ webviewController: web_webview.WebviewController = new web_webview.WebviewController();
+ testObj = {
+ test: (data) => {
+ return "ArkUI Web Component";
+ },
+ toString: () => {
+ console.info('Web Component toString');
+ }
+ }
+
+ build() {
+ Column() {
+ Button('refresh')
+ .onClick(() => {
+ try {
+ this.webviewController.refresh();
+ } catch (error) {
+ console.error(`Errorcode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ Button('Register JavaScript To Window')
+ .onClick(() => {
+ try {
+ this.webviewController.registerJavaScriptProxy(this.testObj, "objName", ["test", "toString"]);
+ } catch (error) {
+ console.error(`Errorcode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ Web({ src: $rawfile('index.html'), controller: this.webviewController })
+ }
+ }
+ }
+ ```
+
+ > **NOTE**
+ >
+ > If you use [registerJavaScriptProxy()](../reference/apis/js-apis-webview.md#registerjavascriptproxy) to register a function, call **[refresh()]**(../reference/apis/js-apis-webview.md#refresh) for the function to take effect.
+
+
+- Sample code for invoking application functions on the **index.htm** frontend page:
+
+ ```html
+
+
+
+
+ Click Me!
+
+
+
+
+ ```
diff --git a/en/application-dev/web/web-open-in-new-window.md b/en/application-dev/web/web-open-in-new-window.md
new file mode 100644
index 0000000000000000000000000000000000000000..b1162d7788b365c261fee072282d70ce14d6fe3b
--- /dev/null
+++ b/en/application-dev/web/web-open-in-new-window.md
@@ -0,0 +1,69 @@
+# Opening Pages in a New Window
+
+
+The **Web** component provides the capability of opening pages in a new window. You can call [multiWindowAccess()](../reference/arkui-ts/ts-basic-components-web.md#multiwindowaccess9) to specify whether to allow a web page to be opened in a new window. When a new window is opened in the **Web** component, the application will receive a window opening event through [onWindowNew()](../reference/arkui-ts/ts-basic-components-web.md#onwindownew9). You need to add the code for processing the window opening request in the event callback.
+
+
+> **NOTE**
+>
+> - If [allowWindowOpenMethod()](../reference/arkui-ts/ts-basic-components-web.md#allowwindowopenmethod10) is set to **true**, you can open a new window in the frontend page by invoking its JavaScript functions.
+>
+> - If you do not want to open a new window in [onWindowNew()](../reference/arkui-ts/ts-basic-components-web.md#onwindownew9), set the return value of [ControllerHandler.setWebController()](../reference/arkui-ts/ts-basic-components-web.md#setwebcontroller9) to **null**.
+
+
+In the following example, when a user clicks the **Open Page in New Window** button, the application receives a window opening event in the [onWindowNew()](../reference/arkui-ts/ts-basic-components-web.md#onwindownew9) callback.
+
+
+- Application code:
+
+ For details about how to create a window, see [Web Development Examples] (https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Web/Browser).
+
+ ```ts
+ // xxx.ets
+ import web_webview from '@ohos.web.webview';
+ @Entry
+ @Component
+ struct WebComponent {
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+ build() {
+ Column() {
+ Web({ src:$rawfile("window.html"), controller: this.controller })
+ .multiWindowAccess(true)
+ .onWindowNew((event) => {
+ console.info("onWindowNew...");
+ var popController: web_webview.WebviewController = new web_webview.WebviewController();
+ // Create a window, associate it with popController, and have popController returned to the Web component. If you do not need to open a new window, set the return value to event.handler.setWebController(null).
+ event.handler.setWebController(popController);
+ })
+ }
+ }
+ }
+ ```
+
+
+- Code of the **window.html** page:
+
+ ```html
+
+
+
+
+ WindowEvent
+
+
+
+
+
+
+
+ ```
diff --git a/en/application-dev/web/web-page-loading-with-web-components.md b/en/application-dev/web/web-page-loading-with-web-components.md
new file mode 100644
index 0000000000000000000000000000000000000000..ce80eff340649a3ba02dc20e5f0e990ae9bd4e71
--- /dev/null
+++ b/en/application-dev/web/web-page-loading-with-web-components.md
@@ -0,0 +1,140 @@
+# Loading Pages by Using the Web Component
+
+
+Page loading is a basic function of the **Web** component. Depending on the data source, page loading falls into three types: loading of network pages, loading of local pages, and loading of HTML rich text data.
+
+
+If acquisition of network resources is involved in page loading, you need to declare the [ohos.permission.INTERNET](../security/accesstoken-guidelines.md) permission.
+
+
+## Loading Network Pages
+
+You can specify the default network page to be loaded when creating a **Web** component. After the default network page is loaded, call [loadUrl()](../reference/apis/js-apis-webview.md#loadurl) if you want to change the network page displayed by the **Web** component.
+
+
+In the following example, after the **www.example.com** page is loaded by the **Web** component, **loadUrl** is called to change the displayed page to **www.example1.com**.
+
+
+
+```ts
+// xxx.ets
+import web_webview from '@ohos.web.webview';
+
+@Entry
+@Component
+struct WebComponent {
+ webviewController: web_webview.WebviewController = new web_webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('loadUrl')
+ .onClick(() => {
+ try {
+ // Upon button clicking, call loadUrl to redirect to www.example1.com.
+ this.webviewController.loadUrl('www.example1.com');
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ // When creating a Web component, set the default network page to be loaded to www.example.com.
+ Web({ src: 'www.example.com', controller: this.webviewController})
+ }
+ }
+}
+```
+
+
+## Loading Local Pages
+
+Local page files are stored in the application's **rawfile** directory. You can specify the local page to be loaded by default when creating a **Web** component. After page loading is complete, you can call [loadUrl()](../reference/apis/js-apis-webview.md#loadurl) to change the displayed page of the **Web** component.
+
+
+The following example shows how to load a local page file.
+
+
+- Local page file in the application's resources/rawfile directory:
+
+ **Figure 1** Path of local page files
+
+ 
+
+
+- Application code:
+
+ ```ts
+ // xxx.ets
+ import web_webview from '@ohos.web.webview';
+
+ @Entry
+ @Component
+ struct WebComponent {
+ webviewController: web_webview.WebviewController = new web_webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('loadUrl')
+ .onClick(() => {
+ try {
+ // Upon button clicking, call loadUrl to redirect to local1.html.
+ this.webviewController.loadUrl($rawfile("local1.html"));
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ // When creating a Web component, load the local.html file through $rawfile.
+ Web({ src: $rawfile("local.html"), controller: this.webviewController })
+ }
+ }
+ }
+ ```
+
+
+- Code of the **local.html** page:
+
+ ```html
+
+
+
+
+ Hello World
+
+
+ ```
+
+
+## Loading HTML Rich Text Data
+
+The **Web** component provides the [loadData()](../reference/apis/js-apis-webview.md#loaddata) API for you to load HTML rich text data. This API is applicable if you want to display some page sections instead of the entire page.
+
+
+
+```ts
+// xxx.ets
+import web_webview from '@ohos.web.webview';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('loadData')
+ .onClick(() => {
+ try {
+ // Upon button clicking, call loadData to load HTML rich text data.
+ this.controller.loadData(
+ 'Source:source ',
+ 'text/html',
+ 'UTF-8'
+ );
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ // When creating a Web component, set the default network page to be loaded to www.example.com.
+ Web({ src: 'www.example.com', controller: this.controller })
+ }
+ }
+}
+```
diff --git a/en/application-dev/web/web-redirection-and-browsing-history-mgmt.md b/en/application-dev/web/web-redirection-and-browsing-history-mgmt.md
new file mode 100644
index 0000000000000000000000000000000000000000..6edb18eed157d0525bb19c815fae26f51a66d6fa
--- /dev/null
+++ b/en/application-dev/web/web-redirection-and-browsing-history-mgmt.md
@@ -0,0 +1,157 @@
+# Managing Page Redirection and Browsing History Navigation
+
+
+## History Navigation
+
+When a user clicks a web page link on the frontend page, the **Web** component automatically opens and loads the target website by default. When the current page is assigned a new loading link, the address of the accessed web page is automatically recorded. You can call [forward()](../reference/apis/js-apis-webview.md#forward) or [backward()](../reference/apis/js-apis-webview.md#backward) to browse the previous or next history record.
+
+ In the following example, when a user clicks the button, **backward()** is called to go back to the previous page.
+
+```ts
+// xxx.ets
+import web_webview from '@ohos.web.webview';
+
+@Entry
+@Component
+struct WebComponent {
+ webviewController: web_webview.WebviewController = new web_webview.WebviewController();
+ build() {
+ Column() {
+ Button('loadData')
+ .onClick(() => {
+ if (this.webviewController.accessBackward()) {
+ this.webviewController.backward();
+ return true;
+ }
+ })
+ Web({ src: 'https://www.example.com/cn/', controller: this.webviewController})
+ }
+ }
+}
+```
+
+
+If a previous record exists, [accessBackward()](../reference/apis/js-apis-webview.md#accessbackward) will return **true**. Similarly, you can call [accessForward()](../reference/apis/js-apis-webview.md#accessforward) to check whether a next record exists. If you skip the check, [forward()](../reference/apis/js-apis-webview.md#forward) and [backward()](../reference/apis/js-apis-webview.md#backward) will not trigger any action if the user has navigated to the end of history records.
+
+
+## Page Redirection
+
+The **Web** component provides the [onUrlLoadIntercept()](../reference/arkui-ts/ts-basic-components-web.md#onurlloadintercept) API to redirect you from one page to another.
+
+In the following example, the frontend page **route.html** is loaded on to the application home page **Index.ets**, and the user is redirected to the application page **ProfilePage.ets** when clicking the link on the **route.html** page.
+
+- Code of the **index.ets** page:
+
+ ```ts
+ // index.ets
+ import web_webview from '@ohos.web.webview';
+ import router from '@ohos.router';
+ @Entry
+ @Component
+ struct WebComponent {
+ webviewController: web_webview.WebviewController = new web_webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: $rawfile('route.html'), controller: this.webviewController })
+ .onUrlLoadIntercept((event) => {
+ let url: string = event.data as string;
+ if (url.indexOf('native://') === 0) {
+ // Redirect to another page.
+ router.pushUrl({ url:url.substring(9) })
+ return true;
+ }
+ return false;
+ })
+ }
+ }
+ }
+ ```
+
+- Code of the **route.html** page:
+
+ ```html
+
+
+
+
+
+
+
+ ```
+
+- Code of the **ProfilePage.ets** page:
+
+ ```ts
+ @Entry
+ @Component
+ struct ProfilePage {
+ @State message: string = 'Hello World';
+
+ build() {
+ Column() {
+ Text(this.message)
+ .fontSize(20)
+ }
+ }
+ }
+ ```
+
+
+## Cross-Application Redirection
+
+The **Web** component supports redirection from one application to another.
+
+In the following example, when a user clicks the link on the frontend page **call.html**, the user will be redirected to the dial screen of the phone app.
+
+- Application code:
+
+ ```ts
+ // xxx.ets
+ import web_webview from '@ohos.web.webview';
+ import call from '@ohos.telephony.call';
+
+ @Entry
+ @Component
+ struct WebComponent {
+ webviewController: web_webview.WebviewController = new web_webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: $rawfile('xxx.html'), controller: this.webviewController})
+ .onUrlLoadIntercept((event) => {
+ let url: string = event.data as string;
+ // Check whether the link is redirecting to the dial screen of the phone app.
+ if (url.indexOf('tel://') === 0) {
+ // Redirect to the dial screen.
+ call.makeCall(url.substring(6), (err) => {
+ if (!err) {
+ console.info('make call succeeded.');
+ } else {
+ console.info('make call fail, err is:' + JSON.stringify(err));
+ }
+ });
+ return true;
+ }
+ return false;
+ })
+ }
+ }
+ }
+ ```
+
+- Code of the **call.html** page:
+
+ ```html
+
+
+
+
+
+
+
+ ```
diff --git a/en/application-dev/web/web-resource-interception-request-mgmt.md b/en/application-dev/web/web-resource-interception-request-mgmt.md
new file mode 100644
index 0000000000000000000000000000000000000000..c0e01e9ab290bae4a48cc3aad6b7419bae2340d1
--- /dev/null
+++ b/en/application-dev/web/web-resource-interception-request-mgmt.md
@@ -0,0 +1,70 @@
+# Customizing Page Request Responses
+
+
+The **Web** component supports customization of the response to intercepted page requests. You can call [onInterceptRequest()](../reference/arkui-ts/ts-basic-components-web.md#oninterceptrequest9) to customize web page responses, file resource responses, etc.
+
+
+When a resource loading request is initiated on a web page, the application layer will receive the request. The application layer then constructs a local resource response and sends it to the web kernel. On receiving the response, the web kernel parses the response and loads page resources accordingly.
+
+
+In the following example, the **Web** component intercepts the web page request **https://www.intercept.com/test.html** and constructs a custom response in the application code.
+
+
+- Code of the **example.html** page:
+
+ ```html
+
+
+
+
+ example
+
+
+
diff --git a/en/device-dev/subsystems/subsys-power-battery-level-customization.md b/en/device-dev/subsystems/subsys-power-battery-level-customization.md
index 9bf7ec042827f0994f20c4a4212e8a8a041c619c..ab4d120d2d550ecd2b4f47f01329b89e8d3046ba 100644
--- a/en/device-dev/subsystems/subsys-power-battery-level-customization.md
+++ b/en/device-dev/subsystems/subsys-power-battery-level-customization.md
@@ -8,6 +8,7 @@ By default, OpenHarmony provides the battery level based on the current battery
### Constraints
+
The configuration path for battery level customization is subject to the [configuration policy](https://gitee.com/openharmony/customization_config_policy). In this development guide, `/vendor` is used as an example of the configuration path. During actual development, you need to modify the customization path based on the product configuration policy.
## How to Develop
@@ -36,7 +37,7 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
├── battery_config.json
```
-3. Write the custom `battery_config.json` file by referring to the `battery_config.json` file in the default folder of battery level configuration. For example:
+3. Write the custom `battery_config.json` file by referring to the [battery_config.json](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_config.json) file in the default folder of battery level configuration. For example:
```json
{
@@ -54,7 +55,7 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
**Table 1** Battery level configuration
- | Battery Bevel| Battery Volume| Description|
+ | Battery Level| Battery Volume| Description|
| -------- | -------- | -------- |
| shutdown | 5 | Power-off battery level|
| critical | 10 | Extremely low battery level|
@@ -65,7 +66,7 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
| full | 100 | Full battery level|
-4. Write the `BUILD.gn` file by referring to the `BUILD.gn` in the default folder of battery level configuration to pack the `battery_config.json` file to the `//vendor/etc/battery` directory. The configuration is as follows:
+4. Write the `BUILD.gn` file by referring to the [BUILD.gn](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/BUILD.gn) file in the default folder of battery level configuration to pack the `battery_config.json` file to the `//vendor/etc/battery` directory. The configuration is as follows:
```shell
import("//build/ohos.gni") # Reference build/ohos.gni.
@@ -292,6 +293,8 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
## Reference
During development, you can refer to the [default battery level configuration](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_config.json), as shown below:
+
+
```json
{
"soc": {
@@ -306,4 +309,4 @@ During development, you can refer to the [default battery level configuration](h
}
```
-Packing path: `/system/etc/battery`
+Packing path: /system/etc/battery
diff --git a/en/device-dev/subsystems/subsys-power-level-LED-color.md b/en/device-dev/subsystems/subsys-power-level-LED-color.md
index ea940bed43c65616f61dcd15c0d16f892c7593a6..3d82bd2258f4dbb64d7e43e19a1dfd8612cbdfc4 100644
--- a/en/device-dev/subsystems/subsys-power-level-LED-color.md
+++ b/en/device-dev/subsystems/subsys-power-level-LED-color.md
@@ -8,6 +8,7 @@ OpenHarmony provides the battery level and LED color mapping by default. Some pr
### Constraints
+
The configuration path for battery level customization is subject to the [configuration policy](https://gitee.com/openharmony/customization_config_policy). In this development guide, `/vendor` is used as an example of the configuration path. During actual development, you need to modify the customization path based on the product configuration policy.
## How to Develop
@@ -36,7 +37,7 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
├── battery_config.json
```
-3. Write the custom `battery_config.json` file by referring to the `battery_config.json` file in the default folder of battery level and LED color mapping configuration. For example:
+3. Write the custom `battery_config.json` file by referring to the [battery_config.json](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_config.json) file in the default folder of battery level and LED color mapping configuration. For example:
```json
{
@@ -57,18 +58,23 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
}
```
- **Table 1** Description of the battery level and LED color mapping configuration
+ **Table 1** Description of battery levels
- | Item| Description|
+ | Battery Level| Description|
| -------- | -------- |
| low | Low battery level|
| normal | Normal battery level|
| high | High battery level|
+
+ **Table 2** Configuration items for the battery level range and LED color
+
+ | Configuration Item| Description|
+ | -------- | -------- |
| soc | Battery level range|
| rgb | LED RGB combination|
-4. Write the `BUILD.gn` file by referring to the `BUILD.gn` in the default folder of battery level and LED color mapping configuration to pack the `battery_config.json` file to the `//vendor/etc/battery` directory. The configuration is as follows:
+4. Write the `BUILD.gn` file by referring to the [BUILD.gn](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/BUILD.gn) file in the default folder of battery level and LED color mapping configuration to pack the `battery_config.json` file to the `//vendor/etc/battery` directory. The configuration is as follows:
```shell
import("//build/ohos.gni") # Reference build/ohos.gni.
@@ -207,6 +213,8 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
## Reference
During development, you can refer to the [default battery level and LED color mapping configuration](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_config.json), as shown below:
+
+
```json
{
"light": {
@@ -226,4 +234,4 @@ During development, you can refer to the [default battery level and LED color ma
}
```
-Packing path: `/system/etc/battery`
+Packing path: /system/etc/battery
diff --git a/en/website.md b/en/website.md
index c89534497929cd5975debbf051874a1c0c4bbca6..331dd6753217fd8b6e02171abd1fa27b3d637387 100644
--- a/en/website.md
+++ b/en/website.md
@@ -195,7 +195,7 @@
- OpenHarmony Third-Party Components
- [OpenHarmony Third-Party Components](third-party-components/third-party-components-introduction.md)
- - [Using OpenHarmony JS and TS Third-Party Components](third-party-components/npm-third-party-guide.md)
+ - [Using OpenHarmony JS and TS Third-Party Components](third-party-components/ohpm-third-party-guide.md)
- Contribution
- [How to Contribute](contribute/how-to-contribute.md)
diff --git a/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md b/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md
index 8b8fed4ffdf9506f41c1795b3d3a980576b2e8e1..70703d58fc8c57b3145d6c175ce1a88d1e416227 100644
--- a/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md
+++ b/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md
@@ -33,7 +33,7 @@
## 通过跨设备启动UIAbility和ServiceExtensionAbility组件实现多端协同(无返回数据)
-在设备A上通过发起端应用提供的启动按钮,启动设备B上指定的UIAbility。
+在设备A上通过发起端应用提供的启动按钮,启动设备B上指定的UIAbility与ServiceExtensionAbility。
### 接口说明
@@ -43,6 +43,8 @@
| **接口名** | **描述** |
| -------- | -------- |
| startAbility(want: Want, callback: AsyncCallback<void>): void; | 启动UIAbility和ServiceExtensionAbility(callback形式)。 |
+| stopServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void; | 退出启动的ServiceExtensionAbility(callback形式)。 |
+| stopServiceExtensionAbility(want: Want): Promise<void>; | 退出启动的ServiceExtensionAbility(Promise形式)。 |
### 开发步骤
@@ -98,6 +100,22 @@
})
```
+5. 当设备A发起端应用不需要设备B上的ServiceExtensionAbility时,可调用stopServiceExtensionAbility(../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstopserviceextensionability)接口退出。(该接口不支持UIAbility的退出,UIAbility由用户手动通过任务管理退出)
+
+ ```ts
+ let want = {
+ deviceId: getRemoteDeviceId(),
+ bundleName: 'com.example.myapplication',
+ abilityName: 'FuncAbility',
+ moduleName: 'module1', // moduleName非必选
+ }
+ // 退出由startAbility接口启动的ServiceExtensionAbility
+ this.context.stopServiceExtensionAbility(want).then(() => {
+ console.info("stop service extension ability success")
+ }).catch((err) => {
+ console.info("stop service extension ability err is " + JSON.stringify(err))
+ })
+ ```
## 通过跨设备启动UIAbility组件实现多端协同(获取返回数据)
diff --git a/zh-cn/application-dev/media/using-avsession-controller.md b/zh-cn/application-dev/media/using-avsession-controller.md
index 33ae995170abd813a6a9e36c1e312e2f30c8d0d3..50004d1485123d129288763cc43dbb4bd9e0d491 100644
--- a/zh-cn/application-dev/media/using-avsession-controller.md
+++ b/zh-cn/application-dev/media/using-avsession-controller.md
@@ -128,7 +128,7 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
// 注册服务异常监听
AVSessionManager.on('sessionServiceDie', () => {
// 服务端异常,应用清理资源
- console.info('服务端异常');
+ console.info(`服务端异常`);
})
```
@@ -153,16 +153,16 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
// 注册会话激活状态变更监听
controller.on('activeStateChange', (isActive) => {
if (isActive) {
- console.info('控制器卡片按键高亮');
+ console.info(`控制器卡片按键高亮`);
} else {
- console.info('控制器卡片按键变更为无效');
+ console.info(`控制器卡片按键变更为无效`);
}
});
// 注册会话销毁监听
controller.on('sessionDestroy', () => {
- console.info('on sessionDestroy : SUCCESS ');
+ info(`on sessionDestroy : SUCCESS `);
controller.destroy().then(() => {
- console.info('destroy : SUCCESS ');
+ console.info(`destroy : SUCCESS`);
}).catch((err) => {
console.error(`Failed to destroy session. Code: ${err.code}, message: ${err.message}`);
});
@@ -290,14 +290,14 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
command : 'This is my custom command'
}
await controller.sendCommonCommand(commandName, args).then(() => {
- console.info('SendCommonCommand successfully');
+ console.info(`SendCommonCommand successfully`);
}).catch((err) => {
console.error(`Failed to send common command. Code: ${err.code}, message: ${err.message}`);
})
// 设置指定播放列表单项的ID,供session选择播放
let queueItemId: number = 0;
await controller.skipToQueueItem(queueItemId).then(() => {
- console.info('SkipToQueueItem successfully');
+ console.info(`SkipToQueueItem successfully`);
}).catch((err) => {
console.error(`Failed to skip to queue item. Code: ${err.code}, message: ${err.message}`);
});
@@ -316,7 +316,7 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
if (err) {
console.error(`Failed to destroy controller. Code: ${err.code}, message: ${err.message}`);
} else {
- console.info('Destroy controller SUCCESS');
+ console.info(`Destroy controller SUCCESS`);
}
});
}
diff --git a/zh-cn/application-dev/media/using-avsession-developer.md b/zh-cn/application-dev/media/using-avsession-developer.md
index 1435f7af6caafa2803349c33285be7dc41e67ee5..43725a745b7b52e4c87b66267665b857104b3565 100644
--- a/zh-cn/application-dev/media/using-avsession-developer.md
+++ b/zh-cn/application-dev/media/using-avsession-developer.md
@@ -74,7 +74,7 @@
artist: 'ARTIST'
};
session.setAVMetadata(metadata).then(() => {
- console.info('SetAVMetadata successfully');
+ console.info(`SetAVMetadata successfully`);
}).catch((err) => {
console.error(`Failed to set AVMetadata. Code: ${err.code}, message: ${err.message}`);
});
@@ -87,7 +87,7 @@
if (err) {
console.error(`Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`);
} else {
- console.info('SetAVPlaybackState successfully');
+ console.info(`SetAVPlaybackState successfully`);
}
});
}
@@ -132,7 +132,7 @@
lyric : 'This is my lyric'
}
await session.dispatchSessionEvent(eventName, args).then(() => {
- console.info('Dispatch session event successfully');
+ console.info(`Dispatch session event successfully`);
}).catch((err) => {
console.error(`Failed to dispatch session event. Code: ${err.code}, message: ${err.message}`);
})
@@ -150,7 +150,7 @@
extra : 'This is my custom meida packet'
}
await session.setExtras(extras).then(() => {
- console.info('Set extras successfully');
+ console.info(`Set extras successfully`);
}).catch((err) => {
console.error(`Failed to set extras. Code: ${err.code}, message: ${err.message}`);
})
@@ -175,23 +175,23 @@
// 一般在监听器中会对播放器做相应逻辑处理
// 不要忘记处理完后需要通过set接口同步播放相关信息,参考上面的用例
session.on('play', () => {
- console.info('on play , do play task');
+ console.info(`on play , do play task`);
// do some tasks ···
});
session.on('pause', () => {
- console.info('on pause , do pause task');
+ console.info(`on pause , do pause task`);
// do some tasks ···
});
session.on('stop', () => {
- console.info('on stop , do stop task');
+ console.info(`on stop , do stop task`);
// do some tasks ···
});
session.on('playNext', () => {
- console.info('on playNext , do playNext task');
+ console.info(`on playNext , do playNext task`);
// do some tasks ···
});
session.on('playPrevious', () => {
- console.info('on playPrevious , do playPrevious task');
+ console.info(`on playPrevious , do playPrevious task`);
// do some tasks ···
});
session.on('fastForward', () => {
@@ -312,7 +312,7 @@
if (err) {
console.error(`Failed to destroy session. Code: ${err.code}, message: ${err.message}`);
} else {
- console.info('Destroy : SUCCESS ');
+ console.info(`Destroy : SUCCESS `);
}
});
}
diff --git a/zh-cn/application-dev/media/using-distributed-avsession.md b/zh-cn/application-dev/media/using-distributed-avsession.md
index bd1d0cecf89a6348fa2f473c611396cd9be3b316..5a535dd398d0e15e0d30441a3ee060ef5f74e496 100644
--- a/zh-cn/application-dev/media/using-distributed-avsession.md
+++ b/zh-cn/application-dev/media/using-distributed-avsession.md
@@ -36,13 +36,13 @@
let audioDevices;
await audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => {
audioDevices = data;
- console.info('Promise returned to indicate that the device list is obtained.');
+ console.info(`Promise returned to indicate that the device list is obtained.`);
}).catch((err) => {
console.error(`Failed to get devices. Code: ${err.code}, message: ${err.message}`);
});
AVSessionManager.castAudio('all', audioDevices).then(() => {
- console.info('createController : SUCCESS');
+ console.info(`createController : SUCCESS`);
}).catch((err) => {
console.error(`Failed to cast audio. Code: ${err.code}, message: ${err.message}`);
});
diff --git a/zh-cn/application-dev/quick-start/arkts-prop.md b/zh-cn/application-dev/quick-start/arkts-prop.md
index 79c03c4e0842c4483a296c48767443969bd428dd..4e1ae2dc60e9216b3d3adb4f7ef65f92d46bd1a3 100644
--- a/zh-cn/application-dev/quick-start/arkts-prop.md
+++ b/zh-cn/application-dev/quick-start/arkts-prop.md
@@ -275,7 +275,7 @@ struct ReaderComp {
build() {
Row() {
Text(this.title)
- Text(`... ${this.readIt ? 'I have read' : 'I have bot read it'}`)
+ Text(`... ${this.readIt ? 'I have read' : 'I have not read it'}`)
.onClick(() => this.readIt = true)
}
}
diff --git a/zh-cn/application-dev/quick-start/module-configuration-file.md b/zh-cn/application-dev/quick-start/module-configuration-file.md
index bb57b60d01cb810ebdd513610567b5d58c21042f..e8be4f36a1e0af7e1d4abda8b33c445e0a0b218f 100644
--- a/zh-cn/application-dev/quick-start/module-configuration-file.md
+++ b/zh-cn/application-dev/quick-start/module-configuration-file.md
@@ -295,7 +295,7 @@ OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置入口
| [launchType](../application-models/uiability-launch-type.md) | 标识当前UIAbility组件的启动模式,可选标签值: - multiton:标准实例模式,每次启动创建一个新的实例。 - singleton:单实例模式,仅第一次启动创建新实例。 - specified:指定实例模式,运行时由开发者决定是否创建新实例。 | 字符串 | 可缺省,该标签缺省为“singleton”。 |
| description | 标识当前UIAbility组件的描述信息,标签值是字符串类型(最长255字节)或对描述内容的资源索引,要求采用资源索引方式,以支持多语言。 | 字符串 | 该标签可缺省,缺省值为空。 |
| icon | 标识当前UIAbility组件的图标,标签值为图标资源文件的索引。 | 字符串 | 该标签可缺省,缺省值为空。 如果UIAbility被配置为MainElement,该标签必须配置。 |
-| label | 标识当前UIAbility组件对用户显示的名称,标签值配置为该名称的资源索引以支持多语言。 如果UIAbility被配置当前Module的mainElement时,该标签必须配置,且应用内唯一。 | 字符串 | 该标签不可缺省。 |
+| label | 标识当前UIAbility组件对用户显示的名称,标签值配置为该名称的资源索引以支持多语言。 | 字符串 | 该标签可缺省,缺省值为空。 如果UIAbility被配置为MainElement,该标签必须配置。 |
| permissions | 标识当前UIAbility组件自定义的权限信息。当其他应用访问该UIAbility时,需要申请相应的权限信息。 一个数组元素为一个权限名称。通常采用反向域名格式(最大255字节),取值为系统预定义的权限。 | 字符串数组 | 该标签可缺省,缺省值为空。 |
| [metadata](#metadata标签) | 标识当前UIAbility组件的元信息。 | 对象数组 | 该标签可缺省,缺省值为空。 |
| exported | 标识当前UIAbility组件是否可以被其他应用调用。 - true:表示可以被其他应用调用。 - false:表示不可以被其他应用调用。 | 布尔值 | 该标签可缺省,缺省值为false。 |
diff --git a/zh-cn/application-dev/quick-start/module-structure.md b/zh-cn/application-dev/quick-start/module-structure.md
index d859c9c54f5fd7fe1557dba0053b361b3c90b076..347a2406968d518351ac067a305c9c4e0446d7de 100644
--- a/zh-cn/application-dev/quick-start/module-structure.md
+++ b/zh-cn/application-dev/quick-start/module-structure.md
@@ -261,7 +261,7 @@ OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置入口
| name | 标识Ability名称。取值可采用反向域名方式表示,由包名和类名组成,如"com.example.myapplication.EntryAbility";也可采用"."开头的类名方式表示,如".EntryAbility"。 Ability的名称,需在一个应用的范围内保证唯一。说明:在使用DevEco Studio新建项目时,默认生成首个Ability的配置,即"config.json"中"EntryAbility"的配置。如使用其他IDE工具,可自定义名称。该标签最大长度为127个字节。 | 字符串 | 不可缺省 |
| description | 标识对Ability的描述。取值可以是描述性内容,也可以是对描述性内容的资源索引,以支持多语言。该标签最大长度为255个字节。 | 字符串 | 可缺省,缺省值为空。 |
| icon | 标识Ability图标资源文件的索引。取值示例:$media:ability_icon。如果在该Ability的skills属性中,actions的取值包含 "action.system.home",entities取值中包含"entity.system.home",则该Ability的icon将同时作为应用的icon。如果存在多个符合条件的Ability,则取位置靠前的Ability的icon作为应用的icon。 说明:应用的"icon"和"label"是用户可感知配置项,需要区别于当前所有已有的应用"icon"或"label"(至少有一个不同)。 | 字符串 | 可缺省,缺省值为空。 |
-| label | 标识Ability对用户显示的名称。取值可以是Ability名称,也可以是对该名称的资源索引,以支持多语言。如果在该Ability的skills属性中,actions的取值包含 "action.system.home",entities取值中包含"entity.system.home",则该Ability的label将同时作为应用的label。如果存在多个符合条件的Ability,则取位置靠前的Ability的label作为应用的label。 说明: 应用的"icon"和"label"是用户可感知配置项,需要区别于当前所有已有的应用"icon"或"label"(至少有一个不同)。该标签为资源文件中定义的字符串的引用,或以"{}"包括的字符串。该标签最大长度为255个字节。 | 字符串 | 可缺省,缺省值为空。 |
+| label | 标识Ability对用户显示的名称。取值是对该名称的资源索引,支持多语言,例:$string:ability_label。如果在该Ability的skills属性中,actions的取值包含 "action.system.home",entities取值中包含"entity.system.home",则该Ability的label将同时作为应用的label。如果存在多个符合条件的Ability,则取位置靠前的Ability的label作为应用的label。 说明: 应用的"icon"和"label"是用户可感知配置项,需要区别于当前所有已有的应用"icon"或"label"(至少有一个不同)。该标签为资源文件中定义的字符串的引用,或以"{}"包括的字符串。该标签最大长度为255个字节。 | 字符串 | 可缺省,缺省值为空。 |
| uri | 标识Ability的统一资源标识符。该标签最大长度为255个字节。 | 字符串 | 可缺省,对于data类型的Ability不可缺省。 |
| launchType | 标识Ability的启动模式,支持"standard"和"singleton"两种模式: standard:表示该Ability可以有多实例。该模式适用于大多数应用场景。 singleton:表示该Ability在所有任务栈中仅可以有一个实例。例如,具有全局唯一性的呼叫来电界面即采用"singleton"模式。该标签仅适用于默认设备、平板、智慧屏、车机、智能穿戴。 | 字符串 | 可缺省,缺省值为"singleton"。 |
| visible | 标识Ability是否可以被其他应用调用。 true:可以被其他应用调用。 false:不能被其他应用调用。 | 布尔类型 | 可缺省,缺省值为"false"。 |
diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md
index 8d90f427dcc4a296732578e79afc26cf103a3d57..9dc49c54f06b56f5ce09d38fee8a4460d27f205a 100755
--- a/zh-cn/application-dev/reference/apis/Readme-CN.md
+++ b/zh-cn/application-dev/reference/apis/Readme-CN.md
@@ -314,8 +314,6 @@
- [Timer (定时器)](js-apis-timer.md)
- application
- [AccessibilityExtensionContext (辅助功能扩展上下文)](js-apis-inner-application-accessibilityExtensionContext.md)
- - imf
- - [InputMethodCommon](js-apis-inputmethod-InputMethodCommon.md)
- 设备管理
- [@ohos.batteryInfo (电量信息)](js-apis-battery-info.md)
@@ -356,8 +354,9 @@
- 定制管理
- [@ohos.configPolicy (配置策略)](js-apis-configPolicy.md)
- [@ohos.enterprise.accountManager (帐户管理)](js-apis-enterprise-accountManager.md)
- - [@ohos.enterprise.bundleManager (包管理)](js-apis-enterprise-bundleManager.md)
- [@ohos.enterprise.adminManager (企业设备管理)](js-apis-enterprise-adminManager.md)
+ - [@ohos.enterprise.applicationManager (应用管理)](js-apis-enterprise-applicationManager.md)
+ - [@ohos.enterprise.bundleManager (包管理)](js-apis-enterprise-bundleManager.md)
- [@ohos.enterprise.dateTimeManager (系统时间管理)](js-apis-enterprise-dateTimeManager.md)
- [@ohos.enterprise.deviceControl (设备控制管理)](js-apis-enterprise-deviceControl.md)
- [@ohos.enterprise.deviceInfo (设备信息管理)](js-apis-enterprise-deviceInfo.md)
diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md
index 8e521d379da256f91114d62f06a822f01903758c..d373237d580efd7dfba53f3d326035b68679b1ad 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md
@@ -145,6 +145,29 @@ Extension生命周期回调,如果是connectAbility拉起的服务,会在onC
}
```
+如果生成返回值RemoteObject依赖一个异步接口,可以使用异步生命周期:
+
+ ```ts
+import rpc from '@ohos.rpc';
+class StubTest extends rpc.RemoteObject{
+ constructor(des) {
+ super(des);
+ }
+ onConnect(code, data, reply, option) {
+ }
+}
+async function getDescriptor() {
+ // 调用异步函数...
+ return "asyncTest"
+}
+class ServiceExt extends ServiceExtension {
+ async onConnect(want) {
+ console.log(`onConnect , want: ${want.abilityName}`);
+ let descriptor = await getDescriptor();
+ return new StubTest(descriptor);
+ }
+}
+ ```
## ServiceExtensionAbility.onDisconnect
@@ -172,6 +195,17 @@ Extension的生命周期回调,客户端执行断开连接服务时回调。
}
```
+在执行完onDisconnect生命周期回调后,应用可能会退出,从而可能导致onDisconnect中的异步函数未能正确执行,比如异步写入数据库。可以使用异步生命周期,以确保异步onDisconnect完成后再继续后续的生命周期。
+
+ ```ts
+class ServiceExt extends ServiceExtension {
+ async onDisconnect(want) {
+ console.log('onDisconnect, want: ${want.abilityName}');
+ // 调用异步函数...
+ }
+}
+ ```
+
## ServiceExtensionAbility.onReconnect
onReconnect(want: Want): void;
diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
index da52ea4a49fc2b6c10123538a887f08ee4310357..006fb918543d1400ac979a02eb0dd126cd91e1bf 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
@@ -132,6 +132,7 @@ UIAbility生命周期回调,在销毁时回调,执行资源清理等操作
**示例:**
+
```ts
class MyUIAbility extends UIAbility {
onDestroy() {
@@ -140,6 +141,16 @@ UIAbility生命周期回调,在销毁时回调,执行资源清理等操作
}
```
+在执行完onDestroy生命周期回调后,应用可能会退出,从而可能导致onDestroy中的异步函数未能正确执行,比如异步写入数据库。可以使用异步生命周期,以确保异步onDestroy完成后再继续后续的生命周期。
+
+ ```ts
+class MyUIAbility extends UIAbility {
+ async onDestroy() {
+ console.log('onDestroy');
+ // 调用异步函数...
+ }
+}
+ ```
## UIAbility.onForeground
diff --git a/zh-cn/application-dev/reference/apis/js-apis-avsession.md b/zh-cn/application-dev/reference/apis/js-apis-avsession.md
index e479203da8df13119334a1dd8f01f27f10a276c5..7b1b3f501ac63e4845cd68a56b61cee11147f06b 100755
--- a/zh-cn/application-dev/reference/apis/js-apis-avsession.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-avsession.md
@@ -445,13 +445,13 @@ let audioRoutingManager = audioManager.getRoutingManager();
let audioDevices;
await audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => {
audioDevices = data;
- console.info('Promise returned to indicate that the device list is obtained.');
+ console.info(`Promise returned to indicate that the device list is obtained.`);
}).catch((err) => {
console.info(`GetDevices BusinessError: code: ${err.code}, message: ${err.message}`);
});
avSession.castAudio('all', audioDevices).then(() => {
- console.info('CreateController : SUCCESS');
+ console.info(`CreateController : SUCCESS`);
}).catch((err) => {
console.info(`CreateController BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -498,7 +498,7 @@ let audioRoutingManager = audioManager.getRoutingManager();
let audioDevices;
await audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => {
audioDevices = data;
- console.info('Promise returned to indicate that the device list is obtained.');
+ console.info(`Promise returned to indicate that the device list is obtained.`);
}).catch((err) => {
console.info(`GetDevices BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -507,7 +507,7 @@ avSession.castAudio('all', audioDevices, function (err) {
if (err) {
console.info(`CastAudio BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('CastAudio : SUCCESS ');
+ console.info(`CastAudio : SUCCESS `);
}
});
```
@@ -622,7 +622,7 @@ on(type: 'sessionServiceDie', callback: () => void): void
```js
avSession.on('sessionServiceDie', () => {
- console.info('on sessionServiceDie : session is Died ');
+ console.info(`on sessionServiceDie : session is Died `);
});
```
@@ -696,7 +696,7 @@ let keyItem = {code:0x49, pressedTime:2, deviceId:0};
let event = {id:1, deviceId:0, actionTime:1, screenId:1, windowId:1, action:2, key:keyItem, unicodeChar:0, keys:[keyItem], ctrlKey:false, altKey:false, shiftKey:false, logoKey:false, fnKey:false, capsLock:false, numLock:false, scrollLock:false};
avSession.sendSystemAVKeyEvent(event).then(() => {
- console.info('SendSystemAVKeyEvent Successfully');
+ console.info(`SendSystemAVKeyEvent Successfully`);
}).catch((err) => {
console.info(`SendSystemAVKeyEvent BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -740,7 +740,7 @@ avSession.sendSystemAVKeyEvent(event, function (err) {
if (err) {
console.info(`SendSystemAVKeyEvent BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('SendSystemAVKeyEvent : SUCCESS ');
+ console.info(`SendSystemAVKeyEvent : SUCCESS `);
}
});
```
@@ -798,7 +798,7 @@ let avcommand = {command:cmd};
// let cmd : avSession.AVControlCommandType = 'toggleFavorite';
// let avcommand = {command:cmd, parameter:"false"};
avSession.sendSystemControlCommand(avcommand).then(() => {
- console.info('SendSystemControlCommand successfully');
+ console.info(`SendSystemControlCommand successfully`);
}).catch((err) => {
console.info(`SendSystemControlCommand BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -855,7 +855,7 @@ avSession.sendSystemControlCommand(avcommand, function (err) {
if (err) {
console.info(`SendSystemControlCommand BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('sendSystemControlCommand successfully');
+ console.info(`sendSystemControlCommand successfully`);
}
});
```
@@ -931,7 +931,7 @@ let metadata = {
nextAssetId: "121279",
};
session.setAVMetadata(metadata).then(() => {
- console.info('SetAVMetadata successfully');
+ console.info(`SetAVMetadata successfully`);
}).catch((err) => {
console.info(`SetAVMetadata BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -985,7 +985,7 @@ session.setAVMetadata(metadata, function (err) {
if (err) {
console.info(`SetAVMetadata BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('SetAVMetadata successfully');
+ console.info(`SetAVMetadata successfully`);
}
});
```
@@ -1032,7 +1032,7 @@ let playbackState = {
isFavorite:true,
};
session.setAVPlaybackState(playbackState).then(() => {
- console.info('SetAVPlaybackState successfully');
+ console.info(`SetAVPlaybackState successfully`);
}).catch((err) => {
console.info(`SetAVPlaybackState BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -1078,7 +1078,7 @@ session.setAVPlaybackState(PlaybackState, function (err) {
if (err) {
console.info(`SetAVPlaybackState BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('SetAVPlaybackState successfully');
+ console.info(`SetAVPlaybackState successfully`);
}
});
```
@@ -1091,8 +1091,6 @@ setAVQueueItems(items: Array\): Promise
**系统能力:** SystemCapability.Multimedia.AVSession.Core
-**系统接口:** 该接口为系统接口
-
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1144,7 +1142,7 @@ let queueItem_2 = {
};
let queueItemsArray = [queueItem_1, queueItem_2];
session.setAVQueueItems(queueItemsArray).then(() => {
- console.info('SetAVQueueItems successfully');
+ console.info(`SetAVQueueItems successfully`);
}).catch((err) => {
console.info(`SetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -1158,8 +1156,6 @@ setAVQueueItems(items: Array\, callback: AsyncCallback): voi
**系统能力:** SystemCapability.Multimedia.AVSession.Core
-**系统接口:** 该接口为系统接口
-
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1209,7 +1205,7 @@ session.setAVQueueItems(queueItemsArray, function (err) {
if (err) {
console.info(`SetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('SetAVQueueItems successfully');
+ console.info(`SetAVQueueItems successfully`);
}
});
```
@@ -1222,8 +1218,6 @@ setAVQueueTitle(title: string): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
-**系统接口:** 该接口为系统接口
-
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1249,7 +1243,7 @@ setAVQueueTitle(title: string): Promise\
```js
let queueTitle = 'QUEUE_TITLE';
session.setAVQueueTitle(queueTitle).then(() => {
- console.info('SetAVQueueTitle successfully');
+ console.info(`SetAVQueueTitle successfully`);
}).catch((err) => {
console.info(`SetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -1263,8 +1257,6 @@ setAVQueueTitle(title: string, callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
-**系统接口:** 该接口为系统接口
-
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1288,7 +1280,7 @@ session.setAVQueueTitle(queueTitle, function (err) {
if (err) {
console.info(`SetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('SetAVQueueTitle successfully');
+ console.info(`SetAVQueueTitle successfully`);
}
});
```
@@ -1358,7 +1350,7 @@ let wantAgentInfo = {
wantAgent.getWantAgent(wantAgentInfo).then((agent) => {
session.setLaunchAbility(agent).then(() => {
- console.info('SetLaunchAbility successfully');
+ console.info(`SetLaunchAbility successfully`);
}).catch((err) => {
console.info(`SetLaunchAbility BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -1428,7 +1420,7 @@ wantAgent.getWantAgent(wantAgentInfo).then((agent) => {
if (err) {
console.info(`SetLaunchAbility BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('SetLaunchAbility successfully');
+ console.info(`SetLaunchAbility successfully`);
}
});
});
@@ -1442,8 +1434,6 @@ dispatchSessionEvent(event: string, args: {[key: string]: Object}): Promise\ **说明:**
+> 参数args支持的数据类型有:字符串、数字、布尔、对象、数组和文件描述符等,详细介绍请参见[@ohos.app.ability.Want(Want)](./js-apis-app-ability-want.md)。
+
**返回值:**
| 类型 | 说明 |
@@ -1485,8 +1478,6 @@ dispatchSessionEvent(event: string, args: {[key: string]: Object}, callback: Asy
**系统能力:** SystemCapability.Multimedia.AVSession.Core
-**系统接口:** 该接口为系统接口
-
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1495,6 +1486,9 @@ dispatchSessionEvent(event: string, args: {[key: string]: Object}, callback: Asy
| args | {[key: string]: any} | 是 | 需要传递的会话事件键值对 |
| callback | AsyncCallback | 是 | 回调函数。当会话事件设置成功,err为undefined,否则返回错误对象。 |
+> **说明:**
+> 参数args支持的数据类型有:字符串、数字、布尔、对象、数组和文件描述符等,详细介绍请参见[@ohos.app.ability.Want(Want)](./js-apis-app-ability-want.md)。
+
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -1517,6 +1511,87 @@ await session.dispatchSessionEvent(eventName, args, (err) => {
})
```
+### setExtras10+
+
+setExtras(extras: {[key: string]: Object}): Promise\
+
+媒体提供方设置键值对形式的自定义媒体数据包, 结果通过Promise异步回调方式返回。
+
+**系统能力:** SystemCapability.Multimedia.AVSession.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------- | --------------------------------------------- | ---- | ----------------------------------------------------------- |
+| extras | {[key: string]: Object} | 是 | 需要传递的自定义媒体数据包键值对 |
+
+> **说明:**
+> 参数extras支持的数据类型有:字符串、数字、布尔、对象、数组和文件描述符等,详细介绍请参见[@ohos.app.ability.Want(Want)](./js-apis-app-ability-want.md)。
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------------- | ----------------------------- |
+| Promise | Promise对象。当自定义媒体数据包设置成功,无返回结果,否则返回错误对象。 |
+
+**错误码:**
+以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------------------- |
+| 6600101 | Session service exception. |
+| 6600102 | The session does not exist. |
+
+**示例:**
+
+```js
+let extras = {
+ extras : "This is custom media packet"
+}
+await session.setExtras(extras).catch((err) => {
+ console.info(`setExtras BusinessError: code: ${err.code}, message: ${err.message}`);
+})
+```
+
+### setExtras10+
+
+setExtras(extras: {[key: string]: Object}, callback: AsyncCallback): void
+
+媒体提供方设置键值对形式的自定义媒体数据包, 结果通过callback异步回调方式返回。
+
+**系统能力:** SystemCapability.Multimedia.AVSession.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------- | --------------------------------------------- | ---- | ----------------------------------------------------------- |
+| extras | {[key: string]: any} | 是 | 需要传递的自定义媒体数据包键值对 |
+| callback | AsyncCallback | 是 | 回调函数。当自定义媒体数据包设置成功,err为undefined,否则返回错误对象。 |
+
+> **说明:**
+> 参数extras支持的数据类型有:字符串、数字、布尔、对象、数组和文件描述符等,详细介绍请参见[@ohos.app.ability.Want(Want)](./js-apis-app-ability-want.md)。
+
+**错误码:**
+以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------------------- |
+| 6600101 | Session service exception. |
+| 6600102 | The session does not exist. |
+
+**示例:**
+
+```js
+let extras = {
+ extras : "This is custom media packet"
+}
+await session.setExtras(extras, (err) => {
+ if(err) {
+ console.info(`setExtras BusinessError: code: ${err.code}, message: ${err.message}`);
+ }
+})
+```
+
### getController
getController(): Promise\
@@ -1689,7 +1764,7 @@ activate(): Promise\
```js
session.activate().then(() => {
- console.info('Activate : SUCCESS ');
+ console.info(`Activate : SUCCESS `);
}).catch((err) => {
console.info(`Activate BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -1726,7 +1801,7 @@ session.activate(function (err) {
if (err) {
console.info(`Activate BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('Activate : SUCCESS ');
+ console.info(`Activate : SUCCESS `);
}
});
```
@@ -1759,7 +1834,7 @@ deactivate(): Promise\
```js
session.deactivate().then(() => {
- console.info('Deactivate : SUCCESS ');
+ console.info(`Deactivate : SUCCESS `);
}).catch((err) => {
console.info(`Deactivate BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -1798,7 +1873,7 @@ session.deactivate(function (err) {
if (err) {
console.info(`Deactivate BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('Deactivate : SUCCESS ');
+ console.info(`Deactivate : SUCCESS `);
}
});
```
@@ -1831,7 +1906,7 @@ destroy(): Promise\
```js
session.destroy().then(() => {
- console.info('Destroy : SUCCESS ');
+ console.info(`Destroy : SUCCESS `);
}).catch((err) => {
console.info(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -1868,7 +1943,7 @@ session.destroy(function (err) {
if (err) {
console.info(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('Destroy : SUCCESS ');
+ console.info(`Destroy : SUCCESS `);
}
});
```
@@ -1902,25 +1977,25 @@ on(type: 'play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind',
```js
session.on('play', () => {
- console.info('on play entry');
+ console.info(`on play entry`);
});
session.on('pause', () => {
- console.info('on pause entry');
+ console.info(`on pause entry`);
});
session.on('stop', () => {
- console.info('on stop entry');
+ console.info(`on stop entry`);
});
session.on('playNext', () => {
- console.info('on playNext entry');
+ console.info(`on playNext entry`);
});
session.on('playPrevious', () => {
- console.info('on playPrevious entry');
+ console.info(`on playPrevious entry`);
});
session.on('fastForward', () => {
- console.info('on fastForward entry');
+ console.info(`on fastForward entry`);
});
session.on('rewind', () => {
- console.info('on rewind entry');
+ console.info(`on rewind entry`);
});
```
@@ -2170,7 +2245,7 @@ on(type: 'commonCommand', callback: (command: string, args: {[key: string]: Obje
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 事件回调类型,支持事件`'commonCommand'`:当自定义控制命令变化时,触发该事件。 |
-| callback | (commonCommand: string, args: {[key:string]: Object}) => void | 是 | 回调函数,commonCommand为变化的自定义控制命令名,args为自定义控制命令的参数。 |
+| callback | (commonCommand: string, args: {[key:string]: Object}) => void | 是 | 回调函数,commonCommand为变化的自定义控制命令名,args为自定义控制命令的参数,参数内容与sendCommand方法设置的参数内容完全一致。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -2744,7 +2819,7 @@ skipToQueueItem(itemId: number): Promise\
```js
let queueItemId = 0;
controller.skipToQueueItem(queueItemId).then(() => {
- console.info('SkipToQueueItem successfully');
+ console.info(`SkipToQueueItem successfully`);
}).catch((err) => {
console.info(`SkipToQueueItem BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -2783,7 +2858,7 @@ controller.skipToQueueItem(queueItemId, function (err) {
if (err) {
console.info(`SkipToQueueItem BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('SkipToQueueItem successfully');
+ console.info(`SkipToQueueItem successfully`);
}
});
```
@@ -2927,6 +3002,74 @@ controller.getOutputDevice(function (err, deviceInfo) {
});
```
+### getExtras10+
+
+getExtras(): Promise\<{[key: string]: Object}>
+
+获取媒体提供方设置的自定义媒体数据包。结果通过Promise异步回调方式返回。
+
+**系统能力:** SystemCapability.Multimedia.AVSession.Core
+
+**系统接口:** 该接口为系统接口
+
+**返回值:**
+
+| 类型 | 说明 |
+| ----------------------------------- | ----------------------------- |
+| Promise<{[key: string]: Object}\> | Promise对象,返回媒体提供方设置的自定义媒体数据包,数据包的内容与setExtras设置的内容完全一致。 |
+
+**错误码:**
+以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------------------- |
+| 6600101 | Session service exception. |
+| 6600102 | The session does not exist. |
+| 6600103 | The session controller does not exist. |
+
+**示例:**
+```js
+let extras = await controller.getExtras().catch((err) => {
+ console.info(`getExtras BusinessError: code: ${err.code}, message: ${err.message}`);
+});
+```
+
+### getExtras10+
+
+getExtras(callback: AsyncCallback\<{[key: string]: Object}>): void
+
+获取媒体提供方设置的自定义媒体数据包,结果通过callback异步回调方式返回。
+
+**系统能力:** SystemCapability.Multimedia.AVSession.Core
+
+**系统接口:** 该接口为系统接口
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----------------------------------------- | ---- | -------------------------- |
+| callback | AsyncCallback<{[key: string]: Object}\> | 是 | 回调函数,返回媒体提供方设置的自定义媒体数据包,数据包的内容与setExtras设置的内容完全一致。 |
+
+**错误码:**
+以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------------------- |
+| 6600101 | Session service exception. |
+| 6600102 | The session does not exist. |
+| 6600103 | The session controller does not exist. |
+
+**示例:**
+```js
+controller.getExtras(function (err, extras) {
+ if (err) {
+ console.info(`getExtras BusinessError: code: ${err.code}, message: ${err.message}`);
+ } else {
+ console.info(`getExtras : SUCCESS : assetId : ${metadata.assetId}`);
+ }
+});
+```
+
### sendAVKeyEvent
sendAVKeyEvent(event: KeyEvent): Promise\
@@ -2967,7 +3110,7 @@ let keyItem = {code:0x49, pressedTime:2, deviceId:0};
let event = {action:2, key:keyItem, keys:[keyItem]};
controller.sendAVKeyEvent(event).then(() => {
- console.info('SendAVKeyEvent Successfully');
+ console.info(`SendAVKeyEvent Successfully`);
}).catch((err) => {
console.info(`SendAVKeyEvent BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -3011,7 +3154,7 @@ controller.sendAVKeyEvent(event, function (err) {
if (err) {
console.info(`SendAVKeyEvent BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('SendAVKeyEvent Successfully');
+ console.info(`SendAVKeyEvent Successfully`);
}
});
```
@@ -3222,7 +3365,7 @@ destroy(): Promise\
```js
controller.destroy().then(() => {
- console.info('Destroy : SUCCESS ');
+ console.info(`Destroy : SUCCESS `);
}).catch((err) => {
console.info(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -3259,7 +3402,7 @@ controller.destroy(function (err) {
if (err) {
console.info(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('Destroy : SUCCESS ');
+ console.info(`Destroy : SUCCESS `);
}
});
```
@@ -3342,6 +3485,10 @@ sendControlCommand(command: AVControlCommand): Promise\
通过控制器发送命令到其对应的会话。结果通过Promise异步回调方式返回。
+> **说明:**
+>
+> 媒体控制方在使用sendControlCommand命令前,需要确保控制对应的媒体会话注册了对应的监听,注册媒体会话相关监听的方法请参见接口[注册媒体会话相关监听](#onplaypausestopplaynextplaypreviousfastforwardrewind)。
+
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
@@ -3385,7 +3532,7 @@ let avCommand = {command:'play'};
// let avCommand = {command:'setLoopMode', parameter:avSession.LoopMode.LOOP_MODE_SINGLE};
// let avCommand = {command:'toggleFavorite', parameter:"false"};
controller.sendControlCommand(avCommand).then(() => {
- console.info('SendControlCommand successfully');
+ console.info(`SendControlCommand successfully`);
}).catch((err) => {
console.info(`SendControlCommand BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -3397,6 +3544,10 @@ sendControlCommand(command: AVControlCommand, callback: AsyncCallback\): v
通过会话控制器发送命令到其对应的会话。结果通过callback异步回调方式返回。
+> **说明:**
+>
+> 媒体控制方在使用sendControlCommand命令前,需要确保控制对应的媒体会话注册了对应的监听,注册媒体会话相关监听的方法请参见接口[注册媒体会话相关监听](#onplaypausestopplaynextplaypreviousfastforwardrewind)。
+
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
@@ -3438,7 +3589,7 @@ controller.sendControlCommand(avCommand, function (err) {
if (err) {
console.info(`SendControlCommand BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info('SendControlCommand successfully');
+ console.info(`SendControlCommand successfully`);
}
});
```
@@ -3458,6 +3609,9 @@ sendCommonCommand(command: string, args: {[key: string]: Object}): Promise\ **说明:**
+> 参数args支持的数据类型有:字符串、数字、布尔、对象、数组和文件描述符等,详细介绍请参见[@ohos.app.ability.Want(Want)](./js-apis-app-ability-want.md)。
+
**返回值:**
| 类型 | 说明 |
@@ -3504,6 +3658,9 @@ sendCommonCommand(command: string, args: {[key: string]: Object}, callback: Asyn
| args | {[key: string]: any} | 是 | 需要传递的控制命令键值对 |
| callback | AsyncCallback | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+> **说明:**
+> 参数args支持的数据类型有:字符串、数字、布尔、对象、数组和文件描述符等,详细介绍请参见[@ohos.app.ability.Want(Want)](./js-apis-app-ability-want.md)。
+
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -3707,6 +3864,40 @@ controller.on('queueTitleChange', (title) => {
});
```
+### on('extrasChange')10+
+
+on(type: 'extrasChange', callback: (extras: {[key:string]: Object}) => void): void
+
+媒体控制器设置自定义媒体数据包事件变化的监听器。
+
+**系统能力:** SystemCapability.Multimedia.AVSession.Core
+
+**系统接口:** 该接口为系统接口
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 事件回调类型,支持事件`'extrasChange'`:当媒体提供方设置自定义媒体数据包时,触发该事件。 |
+| callback | (extras: {[key:string]: object}) => void | 是 | 回调函数,extras为媒体提供方新设置的自定义媒体数据包,该自定义媒体数据包与dispatchSessionEvent方法设置的数据包完全一致。 |
+
+**错误码:**
+以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ------------------------------ |
+| 6600101 | Session service exception. |
+| 6600103 | The session controller does not exist. |
+| 401 | Parameter check failed |
+
+**示例:**
+
+```js
+controller.on('extrasChange', (extras) => {
+ console.info(`Caught extrasChange event,the new extra is: ${JSON.stringify(extras)}`);
+});
+```
+
### on('sessionDestroy')
on(type: 'sessionDestroy', callback: () => void)
@@ -3736,7 +3927,7 @@ on(type: 'sessionDestroy', callback: () => void)
```js
controller.on('sessionDestroy', () => {
- console.info('on sessionDestroy : SUCCESS ');
+ console.info(`on sessionDestroy : SUCCESS `);
});
```
@@ -3844,7 +4035,7 @@ controller.on('outputDeviceChange', (device) => {
off(type: 'metadataChange', callback?: (data: AVMetadata) => void)
-控制器取消监听元数据变化的事件。
+媒体控制器取消监听元数据变化的事件。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -3874,7 +4065,7 @@ controller.off('metadataChange');
off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void)
-控制器取消监听播放状态变化的事件。
+媒体控制器取消监听播放状态变化的事件。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -3904,7 +4095,7 @@ controller.off('playbackStateChange');
off(type: 'sessionEvent', callback?: (sessionEvent: string, args: {[key:string]: Obejct}) => void): void
-控制器取消监听会话事件的变化通知。
+媒体控制器取消监听会话事件的变化通知。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -3934,7 +4125,7 @@ controller.off('sessionEvent');
off(type: 'queueItemsChange', callback?: (items: Array<[AVQueueItem](#avqueueitem10)\>) => void): void
-控制器取消监听播放列表变化的事件。
+媒体控制器取消监听播放列表变化的事件。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -3964,7 +4155,7 @@ controller.off('queueItemsChange');
off(type: 'queueTitleChange', callback?: (title: string) => void): void
-控制器取消监听播放列表名称变化的事件。
+媒体控制器取消监听播放列表名称变化的事件。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -3990,11 +4181,43 @@ off(type: 'queueTitleChange', callback?: (title: string) => void): void
controller.off('queueTitleChange');
```
+### off('extrasChange')10+
+
+off(type: 'extrasChange', callback?: (extras: {[key:string]: Object}) => void): void
+
+媒体控制器取消监听自定义媒体数据包变化事件。
+
+**系统能力:** SystemCapability.Multimedia.AVSession.Core
+
+**系统接口:** 该接口为系统接口
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----------------------- | ---- | ------------------------------------------------------------------------------------------------------- |
+| type | string | 是 | 取消对应的监听事件,支持事件`'extrasChange'`。 |
+| callback | ({[key:string]: Object}) => void | 否 | 注册监听事件时的回调函数。 该参数为可选参数,若不填写该参数,则认为取消会话所有与此事件相关的监听。 |
+
+**错误码:**
+以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------- |
+| 6600101 | Session service exception. |
+| 6600103 | The session controller does not exist. |
+| 401 | Parameter check failed |
+
+**示例:**
+
+```js
+controller.off('extrasChange');
+```
+
### off('sessionDestroy')
off(type: 'sessionDestroy', callback?: () => void)
-控制器取消监听会话的销毁事件。
+媒体控制器取消监听会话的销毁事件。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -4024,7 +4247,7 @@ controller.off('sessionDestroy');
off(type: 'activeStateChange', callback?: (isActive: boolean) => void)
-控制器取消监听会话激活状态变化的事件。
+媒体控制器取消监听会话激活状态变化的事件。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -4054,7 +4277,7 @@ controller.off('activeStateChange');
off(type: 'validCommandChange', callback?: (commands: Array\) => void)
-控制器取消监听会话有效命令变化的事件。
+媒体控制器取消监听会话有效命令变化的事件。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -4084,7 +4307,7 @@ controller.off('validCommandChange');
off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void
-控制器取消监听分布式设备变化的事件。
+媒体控制器取消监听分布式设备变化的事件。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -4261,6 +4484,8 @@ controller.off('outputDeviceChange');
| bufferedTime | number | 否 | 缓冲时间 |
| loopMode | [LoopMode](#loopmode) | 否 | 循环模式 |
| isFavorite | boolean | 否 | 是否收藏 |
+| activeItemId10+ | number | 否 | 正在播放的媒体Id |
+| extras10+ | {[key: string]: Object} | 否 | 自定义媒体数据 |
## PlaybackPosition
@@ -4339,4 +4564,6 @@ controller.off('outputDeviceChange');
| ERR_CODE_REMOTE_CONNECTION_ERR | 6600104 | The remote session connection failed. |
| ERR_CODE_COMMAND_INVALID | 6600105 | Invalid session command. |
| ERR_CODE_SESSION_INACTIVE | 6600106 | The session is not activated. |
-| ERR_CODE_MESSAGE_OVERLOAD | 6600107 | Too many commands or events. |
\ No newline at end of file
+| ERR_CODE_MESSAGE_OVERLOAD | 6600107 | Too many commands or events. |
+
+
diff --git a/zh-cn/application-dev/reference/apis/js-apis-enterprise-applicationManager.md b/zh-cn/application-dev/reference/apis/js-apis-enterprise-applicationManager.md
new file mode 100644
index 0000000000000000000000000000000000000000..d8e0a0c39e1018461350434f2c1167c3f9a6d057
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-enterprise-applicationManager.md
@@ -0,0 +1,433 @@
+# @ohos.enterprise.applicationManager(应用管理)
+
+本模块提供应用管理能力,包括添加应用运行黑名单、获取应用运行黑名单、移除应用运行黑名单等。仅企业设备管理员应用才能调用。
+
+> **说明:**
+>
+> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+## 导入模块
+
+```js
+import applicationManager from '@ohos.enterprise.applicationManager';
+```
+
+## applicationManager.addDisallowedRunningBundles
+
+addDisallowedRunningBundles(admin: Want, appIds: Array\, callback: AsyncCallback<void>): void;
+
+指定设备管理员应用添加应用运行黑名单接口,使用callback形式返回是否添加成功。添加至黑名单的应用不允许在管理员用户下运行,否则允许运行。
+
+**需要权限:** ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
+
+**系统API**: 此接口为系统接口。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------------------------- | ---- | ------------------------------- |
+| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
+| appIds | Array<string> | 是 | 应用运行的黑名单。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 |
+
+**错误码**:
+
+以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
+
+| 错误码ID | 错误信息 |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+
+**示例:**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = {"com.example.myapplication"};
+
+applicationManager.addDisallowedRunningBundles(wantTemp, appIds, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.addDisallowedRunningBundles
+
+addDisallowedRunningBundles(admin: Want, appIds: Array\, userId: number, callback: AsyncCallback<void>): void;
+
+指定设备管理员应用添加应用运行黑名单接口,使用callback形式返回是否添加成功。添加至黑名单的应用不允许在指定用户(通过userId指定)下运行,否则允许运行。
+
+**需要权限:** ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
+
+**系统API**: 此接口为系统接口。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
+| appIds | Array<string> | 是 | 应用运行的黑名单。 |
+| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
+| callback | AsyncCallback<void> | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
+
+**错误码**:
+
+以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
+
+| 错误码ID | 错误信息 |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**示例:**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = {"com.example.myapplication"};
+
+applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.addDisallowedRunningBundles
+
+addDisallowedRunningBundles(admin: Want, appIds: Array\, userId?: number): Promise<void>;
+
+指定设备管理员应用添加应用运行黑名单接口,使用promise形式返回是否添加成功。如果调用接口时传入了可选参数userId,则添加至黑名单的应用不允许在指定用户下运行,如果调用接口时没有传入参数userId,则添加至黑名单的应用不允许在当前用户下运行。
+
+**需要权限:** ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
+
+**系统API**: 此接口为系统接口。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
+| appIds | Array<string> | 是 | 应用运行的黑名单。 |
+| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------- | ------------------------- |
+| Promise<void> | 无返回结果的Promise对象。当指定设备管理员应用添加应用运行黑名单失败时会抛出错误对象。 |
+
+**错误码**:
+
+以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
+
+| 错误码ID | 错误信息 |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**示例:**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = {"com.example.myapplication"};
+
+applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100).then(() => {
+ console.log("success");
+}).catch(error => {
+ console.log("error code:" + error.code + " error message:" + error.message);
+});
+```
+
+## applicationManager.removeDisallowedRunningBundles
+
+removeDisallowedRunningBundles(admin: Want, appIds: Array\, callback: AsyncCallback<void>): void;
+
+指定设备管理员应用移除应用运行黑名单接口,使用callback形式返回移除结果。在黑名单存在的情况下,在应用运行黑名单中的应用不允许在当前用户下运行。
+
+**需要权限:** ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
+
+**系统API**: 此接口为系统接口。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------------------------- | ---- | ------------------------------- |
+| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
+| appIds | Array<string> | 是 | 应用运行的黑名单。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 |
+
+**错误码**:
+
+以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
+
+| 错误码ID | 错误信息 |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**示例:**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = {"com.example.myapplication"};
+
+applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.removeDisallowedRunningBundles
+
+removeDisallowedRunningBundles(admin: Want, appIds: Array\, userId: number, callback: AsyncCallback<void>): void;
+
+指定设备管理员应用移除应用运行黑名单接口,使用callback形式返回移除结果。在黑名单存在的情况下,在应用运行黑名单中的应用不允许在指定用户(通过userId指定)下运行。
+
+**需要权限:** ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
+
+**系统API**: 此接口为系统接口。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
+| appIds | Array<string> | 是 | 应用运行的黑名单。 |
+| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 |
+
+**错误码**:
+
+以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
+
+| 错误码ID | 错误信息 |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**示例:**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = {"com.example.myapplication"};
+
+applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.removeDisallowedRunningBundles
+
+removeDisallowedRunningBundles(admin: Want, appIds: Array\, userId?: number): Promise<void>;
+
+指定设备管理员应用移除应用运行黑名单接口,使用promise形式返回移除结果。在黑名单存在的情况下,如果调用接口时传入参数userId,则在应用运行黑名单中的应用不允许在指定用户下运行,如果调用接口时没有传入参数userId,则在应用运行黑名单中的应用不允许在当前用户下运行。
+
+**需要权限:** ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
+
+**系统API**: 此接口为系统接口。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
+| appIds | Array<string> | 是 | 应用运行的黑名单。 |
+| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------- | ------------------------- |
+| Promise<void> | 无返回结果的Promise对象。当指定设备管理员应用移除应用运行黑名单失败时会抛出错误对象。 |
+
+**错误码**:
+
+以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
+
+| 错误码ID | 错误信息 |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**示例:**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = {"com.example.myapplication"};
+
+applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100).then(() => {
+ console.log("success");
+}).catch(error => {
+ console.log("error code:" + error.code + " error message:" + error.message);
+});
+```
+
+## applicationManager.getDisallowedRunningBundles
+
+getDisallowedRunningBundles(admin: Want, callback: AsyncCallback<Array<string>>): void;
+
+指定管理员应用获取管理员用户下的应用运行黑名单接口,使用callback形式返回获取应用运行黑名单。
+
+**需要权限:** ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
+
+**系统API**: 此接口为系统接口。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------------------------- | ---- | ------------------------------- |
+| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
+| callback | AsyncCallback<Array<string>> | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
+
+**错误码**:
+
+以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
+
+| 错误码ID | 错误信息 |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**示例:**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+
+applicationManager.getDisallowedRunningBundles(wantTemp, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.getDisallowedRunningBundles
+
+getDisallowedRunningBundles(admin: Want, userId: number, callback: AsyncCallback<Array<string>>): void;
+
+指定管理员应用获取指定用户(通过userId指定)下的应用运行黑名单接口,使用callback形式返回获取应用运行黑名单。
+
+**需要权限:** ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
+
+**系统API**: 此接口为系统接口。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------------------------- | ---- | ------------------------------- |
+| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
+| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
+| callback | AsyncCallback<Array<string>> | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
+
+**错误码**:
+
+以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
+
+| 错误码ID | 错误信息 |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**示例:**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+
+applicationManager.getDisallowedRunningBundles(wantTemp, 100, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.getDisallowedRunningBundles
+
+getDisallowedRunningBundles(admin: Want, userId?: number): Promise<Array<string>>;
+
+如果调用接口时传入参数userId,指定管理员应用获取指定用户下应用运行黑名单接口,如果调用接口时没有传入参数userId,指定管理员应用获取当前用户下应用运行黑名单接口,使用promise形式返回获取应用运行黑名单。
+
+**需要权限:** ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
+
+**系统API**: 此接口为系统接口。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
+| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------- | ------------------------- |
+| Promise<Array<string>> | Promise对象,返回管理员用户下的应用运行黑名单。 |
+
+**错误码**:
+
+以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
+
+| 错误码ID | 错误信息 |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**示例:**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+applicationManager.getDisallowedRunningBundles(wantTemp, 100).then(() => {
+ console.log("success");
+}).catch(error => {
+ console.log("error code:" + error.code + " error message:" + error.message);
+});
+```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-fs.md b/zh-cn/application-dev/reference/apis/js-apis-file-fs.md
index 5c1c27049b11ec22b0649134a95dc3016876e3d8..dd1ef8786091e23cd605f4711fc8d6e4479e572d 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-file-fs.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-file-fs.md
@@ -447,6 +447,93 @@ copyFileSync(src: string|number, dest: string|number, mode?: number): void
fs.copyFileSync(srcPath, dstPath);
```
+## fs.copyDir10+
+
+copyDir(src: string, dest: string, mode?: number): Promise\
+
+复制源文件夹至目标路径下,使用Promise异步回调。
+
+**系统能力**:SystemCapability.FileManagement.File.FileIO
+
+**参数:**
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | ------ | ------ | ---- | --------------------------- |
+ | src | string | 是 | 源文件夹的应用沙箱路径。 |
+ | dest | string | 是 | 目标文件夹的应用沙箱路径。 |
+ | mode | number | 否 | 复制模式。默认mode为0。 - mode为0,文件级别抛异常。目标文件夹下存在与源文件夹名冲突的文件夹,若冲突文件夹下存在同名文件,则抛出异常。源文件夹下未冲突的文件全部移动至目标文件夹下,目标文件夹下未冲突文件将继续保留,且冲突文件信息将在抛出异常的data属性中以Array\<[ConflictFiles](#conflictfiles)>形式提供。 - mode为1,文件级别强制覆盖。目标文件夹下存在与源文件夹名冲突的文件夹,若冲突文件夹下存在同名文件,则强制覆盖冲突文件夹下所有同名文件,未冲突文件将继续保留。|
+
+**返回值:**
+
+ | 类型 | 说明 |
+ | ------------------- | ---------------------------- |
+ | Promise<void> | Promise对象。无返回值。 |
+
+**错误码:**
+
+接口抛出错误码的详细介绍请参见[基础文件IO错误码](../errorcodes/errorcode-filemanagement.md#基础文件io错误码)。
+
+**示例:**
+
+ ```js
+ // copy directory from srcPath to destPath
+ let srcPath = pathDir + "/srcDir/";
+ let destPath = pathDir + "/destDir/";
+ fs.copyDir(srcPath, destPath, 0).then(() => {
+ console.info("copy directory succeed");
+ }).catch((err) => {
+ if (err.code == 13900015) {
+ for (let i = 0; i < err.data.length; i++) {
+ console.info("copy directory failed with conflicting files: " + err.data[i].srcFile +
+ " " + err.data[i].destFile);
+ }
+ } else {
+ console.info("copy directory failed with error message: " + err.message + ", error code: " + err.code);
+ }
+ });
+ ```
+
+## fs.copyDir10+
+
+copyDir(src: string, dest: string, mode?: number, callback: AsyncCallback\): void
+
+复制源文件夹至目标路径下,使用Callback异步回调。
+
+**系统能力**:SystemCapability.FileManagement.File.FileIO
+
+**参数:**
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | ------ | ------ | ---- | --------------------------- |
+ | src | string | 是 | 源文件夹的应用沙箱路径。 |
+ | dest | string | 是 | 目标文件夹的应用沙箱路径。 |
+ | mode | number | 否 | 复制模式。默认mode为0。 - mode为0,文件级别抛异常。目标文件夹下存在与源文件夹名冲突的文件夹,若冲突文件夹下存在同名文件,则抛出异常。源文件夹下未冲突的文件全部移动至目标文件夹下,目标文件夹下未冲突文件将继续保留,且冲突文件信息将在抛出异常的data属性中以Array\<[ConflictFiles](#conflictfiles)>形式提供。 - mode为1,文件级别强制覆盖。目标文件夹下存在与源文件夹名冲突的文件夹,若冲突文件夹下存在同名文件,则强制覆盖冲突文件夹下所有同名文件,未冲突文件将继续保留。|
+ | callback | AsyncCallback<void> | 是 | 异步复制文件夹之后的回调。 |
+
+**错误码:**
+
+接口抛出错误码的详细介绍请参见[基础文件IO错误码](../errorcodes/errorcode-filemanagement.md#基础文件io错误码)。
+
+**示例:**
+
+ ```js
+ // copy directory from srcPath to destPath
+ let srcPath = pathDir + "/srcDir/";
+ let destPath = pathDir + "/destDir/";
+ fs.copyDir(srcPath, destPath, 0, (err) => {
+ if (err && err.code == 13900015) {
+ for (let i = 0; i < err.data.length; i++) {
+ console.info("copy directory failed with conflicting files: " + err.data[i].srcFile +
+ " " + err.data[i].destFile);
+ }
+ } else if (err) {
+ console.info("copy directory failed with error message: " + err.message + ", error code: " + err.code);
+ } else {
+ console.info("copy directory succeed");
+ }
+ });
+ ```
+
## fs.mkdir
mkdir(path: string): Promise<void>
@@ -1924,8 +2011,8 @@ moveDir(src: string, dest: string, mode?: number): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | --------------------------- |
| src | string | 是 | 源文件夹的应用沙箱路径。 |
- | dest | string | 是 | 目标应用沙箱路径。 |
- | mode | number | 否 | 移动模式。默认mode为0。 - mode为0,文件夹级别抛异常。若目标路径存在与源文件夹名冲突的文件夹,则抛出异常。 - mode为1,文件级别抛异常。目标路径存在与源文件夹名冲突的文件夹,若此目标文件夹下存在与源文件夹下同名文件,则抛出异常。源文件夹下未冲突的文件全部移动至此目标文件夹下,此目标文件夹下未冲突文件将继续保留,且冲突文件信息将在抛出异常的data属性中提供。 - mode为2,文件级别强制覆盖。目标路径存在与源文件夹名冲突的文件夹,若此目标文件夹下存在与源文件夹下同名文件,则强制覆盖此目标文件夹下所有同名文件。目标文件夹下未冲突文件将继续保留。 - mode为3,文件夹级别强制覆盖。移动源文件夹至目标路径下,目标文件夹与源文件夹内容完全一致。目标文件夹下所有原始文件将不会保留。|
+ | dest | string | 是 | 目标文件夹的应用沙箱路径。 |
+ | mode | number | 否 | 移动模式。默认mode为0。 - mode为0,文件夹级别抛异常。若目标文件夹下存在与源文件夹名冲突的文件夹,则抛出异常。 - mode为1,文件级别抛异常。目标文件夹下存在与源文件夹名冲突的文件夹,若冲突文件夹下存在同名文件,则抛出异常。源文件夹下未冲突的文件全部移动至目标文件夹下,目标文件夹下未冲突文件将继续保留,且冲突文件信息将在抛出异常的data属性中以Array\<[ConflictFiles](#conflictfiles)>形式提供。 - mode为2,文件级别强制覆盖。目标文件夹下存在与源文件夹名冲突的文件夹,若冲突文件夹下存在同名文件,则强制覆盖冲突文件夹下所有同名文件,未冲突文件将继续保留。 - mode为3,文件夹级别强制覆盖。移动源文件夹至目标文件夹下,目标文件夹下移动的文件夹内容与源文件夹完全一致。若目标文件夹下存在与源文件夹名冲突的文件夹,该文件夹下所有原始文件将不会保留。|
**返回值:**
@@ -1940,7 +2027,7 @@ moveDir(src: string, dest: string, mode?: number): Promise\
**示例:**
```js
- // move directory from srcPath to destPath/srcPath
+ // move directory from srcPath to destPath
let srcPath = pathDir + "/srcDir/";
let destPath = pathDir + "/destDir/";
fs.moveDir(srcPath, destPath, 1).then(() => {
@@ -1970,8 +2057,8 @@ moveDir(src: string, dest: string, mode?: number, callback: AsyncCallback\
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | --------------------------- |
| src | string | 是 | 源文件夹的应用沙箱路径。 |
- | dest | string | 是 | 目标应用沙箱路径。 |
- | mode | number | 否 | 移动模式。默认mode为0。 - mode为0,文件夹级别抛异常。若目标路径存在与源文件夹名冲突的文件夹,则抛出异常。 - mode为1,文件级别抛异常。目标路径存在与源文件夹名冲突的文件夹,若此目标文件夹下存在与源文件夹下同名文件,则抛出异常。源文件夹下未冲突的文件全部移动至此目标文件夹下,此目标文件夹下未冲突文件将继续保留,且冲突文件信息将在抛出异常的data属性中提供。 - mode为2,文件级别强制覆盖。目标路径存在与源文件夹名冲突的文件夹,若此目标文件夹下存在与源文件夹下同名文件,则强制覆盖此目标文件夹下所有同名文件。目标文件夹下未冲突文件将继续保留。 - mode为3,文件夹级别强制覆盖。移动源文件夹至目标路径下,目标文件夹与源文件夹内容完全一致。目标文件夹下所有原始文件将不会保留。|
+ | dest | string | 是 | 目标文件夹的应用沙箱路径。 |
+ | mode | number | 否 | 移动模式。默认mode为0。 - mode为0,文件夹级别抛异常。若目标文件夹下存在与源文件夹名冲突的文件夹,则抛出异常。 - mode为1,文件级别抛异常。目标文件夹下存在与源文件夹名冲突的文件夹,若冲突文件夹下存在同名文件,则抛出异常。源文件夹下未冲突的文件全部移动至目标文件夹下,目标文件夹下未冲突文件将继续保留,且冲突文件信息将在抛出异常的data属性中以Array\<[ConflictFiles](#conflictfiles)>形式提供。 - mode为2,文件级别强制覆盖。目标文件夹下存在与源文件夹名冲突的文件夹,若冲突文件夹下存在同名文件,则强制覆盖冲突文件夹下所有同名文件,未冲突文件将继续保留。 - mode为3,文件夹级别强制覆盖。移动源文件夹至目标文件夹下,目标文件夹下移动的文件夹内容与源文件夹完全一致。若目标文件夹下存在与源文件夹名冲突的文件夹,该文件夹下所有原始文件将不会保留。|
| callback | AsyncCallback<void> | 是 | 异步移动文件夹之后的回调。 |
**错误码:**
@@ -1981,7 +2068,7 @@ moveDir(src: string, dest: string, mode?: number, callback: AsyncCallback\
**示例:**
```js
- // move directory from srcPath to destPath/srcPath
+ // move directory from srcPath to destPath
let srcPath = pathDir + "/srcDir/";
let destPath = pathDir + "/destDir/";
fs.moveDir(srcPath, destPath, 1, (err) => {
@@ -3266,3 +3353,14 @@ open接口flags参数常量。文件打开标签。
| fileSizeOver | number | 文件大小匹配,大于等于指定大小的文件。 |
| lastModifiedAfter | number | 文件最近修改时间匹配,在指定时间点及之后的文件。 |
| excludeMedia | boolean | 是否排除Media中已有的文件。 |
+
+## ConflictFiles
+
+**系统能力**:SystemCapability.FileManagement.File.FileIO
+
+冲突文件信息,支持copyDir及moveDir接口使用。
+
+| 名称 | 类型 | 说明 |
+| ----------- | --------------- | ------------------ |
+| srcFile | string | 源冲突文件路径。 |
+| destFile | string | 目标冲突文件路径。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-http.md b/zh-cn/application-dev/reference/apis/js-apis-http.md
index 8900ae208d756c089bb01ab0583cd513d4ba4318..fff275f377c548c54d82a464158b72c5deac9302 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-http.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-http.md
@@ -814,7 +814,7 @@ httpRequest.off('dataProgress');
| extraData | string6+ \| Object6+ \| ArrayBuffer8+ | 否 | 发送请求的额外数据,默认无此字段。 - 当HTTP请求为POST、PUT等方法时,此字段为HTTP请求的content,以UTF-8编码形式作为请求体。6+ - 当HTTP请求为GET、OPTIONS、DELETE、TRACE、CONNECT等方法时,此字段为HTTP请求参数的补充。开发者需传入Encode编码后的string类型参数,Object类型的参数无需预编码,参数内容会拼接到URL中进行发送;ArrayBuffer类型的参数不会做拼接处理。6+ |
| expectDataType9+ | [HttpDataType](#httpdatatype9) | 否 | 指定返回数据的类型,默认无此字段。如果设置了此参数,系统将优先返回指定的类型。 |
| usingCache9+ | boolean | 否 | 是否使用缓存,默认为true。 |
-| priority9+ | number | 否 | 优先级,范围\[0,1000],默认是0。 |
+| priority9+ | number | 否 | 优先级,范围[1,1000],默认是1。 |
| header | Object | 否 | HTTP请求头字段。默认{'Content-Type': 'application/json'}。 |
| readTimeout | number | 否 | 读取超时时间。单位为毫秒(ms),默认为60000ms。 设置为0表示不会出现超时情况。 |
| connectTimeout | number | 否 | 连接超时时间。单位为毫秒(ms),默认为60000ms。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-InputMethodCommon.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-InputMethodCommon.md
deleted file mode 100644
index 325d2f7aca6ddf2f093409faa8ac96e6c9bf84fd..0000000000000000000000000000000000000000
--- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-InputMethodCommon.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# InputMethodCommon
-
-> **说明:**
-> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
-
-输入法框架接口定义的公共属性信息。
-
-## Direction
-
-光标移动方向类型枚举。
-
- **系统能力:** SystemCapability.MiscServices.InputMethodFramework
-
-| 名称 | 值 | 说明 |
-| ------------ | ---- | ---------- |
-| CURSOR_UP | 1 | 光标上移。 |
-| CURSOR_DOWN | 2 | 光标下移。 |
-| CURSOR_LEFT | 3 | 光标左移。 |
-| CURSOR_RIGHT | 4 | 光标右移。 |
-
-## Range
-
-描述选中文本的范围。
-
- **系统能力:** SystemCapability.MiscServices.InputMethodFramework
-
-| 名称 | 类型 | 可读 | 可写 | 说明 |
-| ----- | ------ | ---- | ---- | ---------------------------------- |
-| start | number | 是 | 是 | 选中文本的首字符在编辑框的索引值。 |
-| end | number | 是 | 是 | 选中文本的末字符在编辑框的索引值。 |
-
-## Movement
-
-描述进行选中文本动作时光标移动的方向。
-
- **系统能力:** SystemCapability.MiscServices.InputMethodFramework
-
-| 名称 | 类型 | 可读 | 可写 | 说明 |
-| --------- | ----------------------- | ---- | ---- | ---------------------------------- |
-| direction | [Direction](#direction) | 是 | 是 | 进行选中文本动作时光标移动的方向。 |
-
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md
index df38bad2078cc61c642a4999236d2c83cab7201e..4218b64b14a83133b512b8dc8c3bc0d5df8f8058 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md
@@ -38,9 +38,9 @@ Extension生命周期回调,在拉起Extension输入法应用时调用,执
```js
class InputMethodExt extends InputMethodExtensionAbility {
- onCreate(want) {
- console.log('onCreate, want:' + want.abilityName);
- }
+ onCreate(want) {
+ console.log('onCreate, want:' + want.abilityName);
+ }
}
```
@@ -56,8 +56,8 @@ Extension生命周期回调,在销毁输入法应用时回调,执行资源
```js
class InputMethodExt extends InputMethodExtensionAbility {
- onDestroy() {
- console.log('onDestroy');
- }
+ onDestroy() {
+ console.log('onDestroy');
+ }
}
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
index 263b4f1da9cb4ce51ee3449c806c1f65cc6ed95d..fa5ba2aec075b22fc0900199d0dc200ede8529df 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
@@ -21,9 +21,9 @@ import InputMethodExtensionContext from '@ohos.InputMethodExtensionContext';
```js
import InputMethodExtensionAbility from '@ohos.InputMethodExtensionAbility';
class EntryAbility extends InputMethodExtensionAbility {
- onCreate() {
- let context = this.context;
- }
+ onCreate() {
+ let context = this.context;
+ }
}
```
@@ -44,8 +44,8 @@ destroy(callback: AsyncCallback\): void
**示例:**
```js
-this.context.destroy((err) => {
- console.log('destroy result:' + JSON.stringify(err));
+this.context.destroy(() => {
+ console.log('Succeeded in destroying context.');
});
```
@@ -67,8 +67,6 @@ destroy(): Promise\;
```js
this.context.destroy().then(() => {
- console.log('Succeed in destoring context.');
-}).catch((error) => {
- console.log('Failed to destory context: ' + JSON.stringify(error));
+ console.log('Succeed in destroying context.');
});
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
index 3b05f3c4a6784b92844b5a21ffaf47715f9598da..c485e0dbe524d76ef59518e0947e7a6b4d7cda91 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
@@ -31,13 +31,13 @@ import inputMethod from '@ohos.inputMethod';
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
-| name9+ | string | 是 | 否 | 输入法内部名称。必填。|
-| id9+ | string | 是 | 否 | 输入法唯一标识。必填。|
-| label9+ | string | 是 | 否 | 输入法对外显示名称。 非必填。|
-| labelId10+ | string | 是 | 否 | 输入法对外显示名称资源号。 非必填。|
-| icon9+ | string | 是 | 否 | 输入法图标数据。非必填。 |
-| iconId9+ | number | 是 | 否 | 输入法图标资源号。非必填。 |
-| extra9+ | object | 是 | 是 | 输入法扩展信息。 非必填。 **说明:** 从API version 10开始改为非必选参数。|
+| name9+ | string | 是 | 否 | 必填。输入法内部名称。|
+| id9+ | string | 是 | 否 | 必填。输入法唯一标识。|
+| label9+ | string | 是 | 否 | 非必填。输入法对外显示名称。|
+| labelId10+ | string | 是 | 否 | 非必填。输入法对外显示名称资源号。|
+| icon9+ | string | 是 | 否 | 非必填。输入法图标数据。|
+| iconId9+ | number | 是 | 否 | 非必填。输入法图标资源号。 |
+| extra10+ | object | 是 | 是 | 非必填。输入法扩展信息。|
| packageName(deprecated) | string | 是 | 否 | 输入法包名。必填。 **说明:** 从API version 8开始支持,从API version 9开始废弃,建议使用name替代。 |
| methodId(deprecated) | string | 是 | 否 | 输入法唯一标识。必填。 **说明:** 从API version 8开始支持,从API version 9开始废弃,建议使用id替代。 |
@@ -126,28 +126,21 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolea
**示例:**
```js
-let im = inputMethod.getCurrentInputMethod();
-let prop = {
- packageName: im.packageName,
- methodId: im.methodId,
- name: im.packageName,
- id: im.methodId,
- extra: {}
-}
+let currentIme = inputMethod.getCurrentInputMethod();
try{
- inputMethod.switchInputMethod(prop, (err, result) => {
- if (err !== undefined) {
- console.error('Failed to switchInputMethod: ' + JSON.stringify(err));
- return;
- }
- if (result) {
- console.info('Succeeded in switching inputmethod.');
- } else {
- console.error('Failed to switchInputMethod.');
- }
- });
+ inputMethod.switchInputMethod(currentIme, (err, result) => {
+ if (err) {
+ console.error(`Failed to switchInputMethod: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in switching inputmethod.');
+ } else {
+ console.error('Failed to switchInputMethod.');
+ }
+ });
} catch(err) {
- console.error('Failed to switchInputMethod: ' + JSON.stringify(err));
+ console.error(`Failed to switchInputMethod: ${JSON.stringify(err)}`);
}
```
## inputMethod.switchInputMethod9+
@@ -183,26 +176,19 @@ switchInputMethod(target: InputMethodProperty): Promise<boolean>
**示例:**
```js
-let im = inputMethod.getCurrentInputMethod();
-let prop = {
- packageName: im.packageName,
- methodId: im.methodId,
- name: im.packageName,
- id: im.methodId,
- extra: {}
-}
+let currentIme = inputMethod.getCurrentInputMethod();
try {
- inputMethod.switchInputMethod(prop).then((result) => {
- if (result) {
- console.info('Succeeded in switching inputmethod.');
- } else {
- console.error('Failed to switchInputMethod.');
- }
- }).catch((err) => {
- console.error('Failed to switchInputMethod: ' + JSON.stringify(err));
- })
+ inputMethod.switchInputMethod(currentIme).then((result) => {
+ if (result) {
+ console.log('Succeeded in switching inputmethod.');
+ } else {
+ console.error('Failed to switchInputMethod.');
+ }
+ }).catch((err) => {
+ console.error(`Failed to switchInputMethod: ${JSON.stringify(err)}`);
+ })
} catch(err) {
- console.error('Failed to switchInputMethod: ' + JSON.stringify(err));
+ console.error(`Failed to switchInputMethod: ${JSON.stringify(err)}`);
}
```
@@ -226,7 +212,7 @@ getCurrentInputMethod(): InputMethodProperty
let currentIme = inputMethod.getCurrentInputMethod();
```
-## inputMethod.switchCurrentInputMethodSubtype9+
+## inputMethod.switchCurrentInputMethodSubtype10+
switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback\): void
@@ -256,33 +242,33 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb
```js
try {
- inputMethod.switchCurrentInputMethodSubtype({
- id: "ServiceExtAbility",
- label: "",
- name: "com.example.kikakeyboard",
- mode: "upper",
- locale: "",
- language: "",
- icon: "",
- iconId: 0,
- extra: {}
- }, (err, result) => {
- if (err !== undefined) {
- console.error('Failed to switchCurrentInputMethodSubtype: ' + JSON.stringify(err));
- return;
- }
- if (result) {
- console.info('Succeeded in switching currentInputMethodSubtype.');
- } else {
- console.error('Failed to switchCurrentInputMethodSubtype');
- }
- });
+ inputMethod.switchCurrentInputMethodSubtype({
+ id: "ServiceExtAbility",
+ label: "",
+ name: "com.example.kikakeyboard",
+ mode: "upper",
+ locale: "",
+ language: "",
+ icon: "",
+ iconId: 0,
+ extra: {}
+ }, (err, result) => {
+ if (err) {
+ console.error(`Failed to switchCurrentInputMethodSubtype: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in switching currentInputMethodSubtype.');
+ } else {
+ console.error('Failed to switchCurrentInputMethodSubtype');
+ }
+ });
} catch(err) {
- console.error('Failed to switchCurrentInputMethodSubtype: ' + JSON.stringify(err));
+ console.error(`Failed to switchCurrentInputMethodSubtype: ${JSON.stringify(err)}`);
}
```
-## inputMethod.switchCurrentInputMethodSubtype9+
+## inputMethod.switchCurrentInputMethodSubtype10+
switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean>
@@ -317,27 +303,27 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean&
```js
try {
- inputMethod.switchCurrentInputMethodSubtype({
- id: "ServiceExtAbility",
- label: "",
- name: "com.example.kikakeyboard",
- mode: "upper",
- locale: "",
- language: "",
- icon: "",
- iconId: 0,
- extra: {}
- }).then((result) => {
- if (result) {
- console.info('Succeeded in switching currentInputMethodSubtype.');
- } else {
- console.error('Failed to switchCurrentInputMethodSubtype.');
- }
- }).catch((err) => {
- console.error('Failed to switchCurrentInputMethodSubtype: ' + JSON.stringify(err));
- })
+ inputMethod.switchCurrentInputMethodSubtype({
+ id: "ServiceExtAbility",
+ label: "",
+ name: "com.example.kikakeyboard",
+ mode: "upper",
+ locale: "",
+ language: "",
+ icon: "",
+ iconId: 0,
+ extra: {}
+ }).then((result) => {
+ if (result) {
+ console.log('Succeeded in switching currentInputMethodSubtype.');
+ } else {
+ console.error('Failed to switchCurrentInputMethodSubtype.');
+ }
+ }).catch((err) => {
+ console.error(`Failed to switchCurrentInputMethodSubtype: ${JSON.stringify(err)}`);
+ })
} catch(err) {
- console.error('Failed to switchCurrentInputMethodSubtype: ' + JSON.stringify(err));
+ console.error(`Failed to switchCurrentInputMethodSubtype: ${JSON.stringify(err)}`);
}
```
@@ -365,19 +351,1292 @@ let currentImeSubType = inputMethod.getCurrentInputMethodSubtype();
switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback\): void
-切换至指定输入法应用的指定子类型,用于跨输入法应用切换子类型。使用callback异步回调。
+切换至指定输入法应用的指定子类型,用于跨输入法应用切换子类型。使用callback异步回调。
+
+**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+|inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| 是 | 传入要切换的目标输入法。 |
+|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| 是 | 传入要切换的目标输入法子类型。 |
+| callback | AsyncCallback<boolean> | 是 | 回调函数。当输入法和子类型切换成功,err为undefined,data为获取到的切换子类型结果true;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800005 | Configuration persisting error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+let currentIme = inputMethod.getCurrentInputMethod();
+let imSubType = inputMethod.getCurrentInputMethodSubtype();
+try {
+ inputMethod.switchCurrentInputMethodAndSubtype(currentIme, imSubType, (err,result) => {
+ if (err) {
+ console.error(`Failed to switchCurrentInputMethodAndSubtype: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in switching currentInputMethodAndSubtype.');
+ } else {
+ console.error('Failed to switchCurrentInputMethodAndSubtype.');
+ }
+ });
+} catch (err) {
+ console.error(`Failed to switchCurrentInputMethodAndSubtype: ${JSON.stringify(err)}`);
+}
+```
+
+## inputMethod.switchCurrentInputMethodAndSubtype9+
+
+switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype): Promise<boolean>
+
+切换至指定输入法应用的指定子类型,用于跨输入法应用切换子类型。使用promise异步回调。
+
+**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+|inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| 是 | 传入要切换的目标输入法。 |
+|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| 是 | 传入要切换的目标输入法子类型。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ----------------------------------------- | ---------------------------- |
+| Promise\ | Promise对象。返回true表示切换至指定输入法应用的指定子类型成功;返回false表示切换至指定输入法应用的指定子类型失败。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800005 | Configuration persisting error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+let currentIme = inputMethod.getCurrentInputMethod();
+let imSubType = inputMethod.getCurrentInputMethodSubtype();
+try {
+ inputMethod.switchCurrentInputMethodAndSubtype(currentIme, imSubType).then((result) => {
+ if (result) {
+ console.log('Succeeded in switching currentInputMethodAndSubtype.');
+ } else {
+ console.error('Failed to switchCurrentInputMethodAndSubtype.');
+ }
+ }).catch((err) => {
+ console.error(`Failed to switchCurrentInputMethodAndSubtype: ${JSON.stringify(err)}`);
+ })
+} catch(err) {
+ console.error(`Failed to switchCurrentInputMethodAndSubtype: ${JSON.stringify(err)}`);
+}
+```
+
+## inputMethod.getInputMethodController(deprecated)
+
+getInputMethodController(): InputMethodController
+
+获取客户端实例[InputMethodController](#inputmethodcontroller)。
+
+> **说明:**
+>
+> 从API version 6开始支持,从API version 9开始废弃,建议使用[getController()](#inputmethodgetcontroller9)替代。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**返回值:**
+
+| 类型 | 说明 |
+| ----------------------------------------------- | ------------------------ |
+| [InputMethodController](#inputmethodcontroller) | 回调返回当前客户端实例。 |
+
+**示例:**
+
+```js
+let inputMethodController = inputMethod.getInputMethodController();
+```
+
+## inputMethod.getInputMethodSetting(deprecated)
+
+getInputMethodSetting(): InputMethodSetting
+
+获取客户端设置实例[InputMethodSetting](#inputmethodsetting8)。
+
+> **说明:**
+>
+> 从API version 6开始支持,从API version 9开始废弃,建议使用[getSetting()](#inputmethodgetsetting9)替代。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**返回值:**
+
+| 类型 | 说明 |
+| ----------------------------------------- | ---------------------------- |
+| [InputMethodSetting](#inputmethodsetting8) | 回调返回当前客户端设置实例。 |
+
+**示例:**
+
+```js
+let inputMethodSetting = inputMethod.getInputMethodSetting();
+```
+
+## TextInputType10+
+
+文本输入类型。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 值 |说明 |
+| -------- | -------- |-------- |
+| NONE | -1 |NONE。 |
+| TEXT | 0 |文本类型。 |
+| MULTILINE | 1 |多行类型。 |
+| NUMBER | 2 |数字类型。 |
+| PHONE | 3 |电话号码类型。 |
+| DATETIME | 4 |日期类型。 |
+| EMAIL_ADDRESS | 5 |邮箱地址类型。 |
+| URL | 6 |链接类型。 |
+| VISIBLE_PASSWORD | 7 |密码类型。 |
+
+## EnterKeyType10+
+
+输入法Enter键所代表的功能类型。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 值 |说明 |
+| -------- | -------- |-------- |
+| UNSPECIFIED | 0 |未指定。 |
+| NONE | 1 |NONE。 |
+| GO | 2 |前往。 |
+| SEARCH | 3 |查找。 |
+| SEND | 4 |发送。 |
+| NEXT | 5 |下一步。 |
+| DONE | 6 |完成。 |
+| PREVIOUS | 7 |上一步。 |
+
+## KeyboardStatus10+
+
+输入法软键盘状态。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 值 |说明 |
+| -------- | -------- |-------- |
+| NONE | 0 |NONE。 |
+| HIDE | 1 |隐藏状态。 |
+| SHOW | 2 |显示状态。 |
+
+## Direction10+
+
+光标移动方向。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 值 |说明 |
+| -------- | -------- |-------- |
+| CURSOR_UP | 1 |向上。 |
+| CURSOR_DOWN | 2 |向下。 |
+| CURSOR_LEFT | 3 |向左。 |
+| CURSOR_RIGHT | 4 |向右。 |
+
+## ExtendAction10+
+
+对编辑框中文本的扩展编辑操作类型。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 值 |说明 |
+| -------- | -------- |-------- |
+| SELECT_ALL | 0 |全选。 |
+| CUT | 3 |剪切。 |
+| COPY | 4 |复制。 |
+| PASTE | 5 |粘贴。 |
+
+## FunctionKey10+
+
+输入法功能键类型。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| enterKeyType10+ | [EnterKeyType](#enterkeytype10) | 是 | 是 | 输入法enter键类型。|
+
+## InputAttribute10+
+
+编辑框属性,包含文本输入类型,Enter键功能类型。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| textInputType10+ | [TextInputType](#textinputtype10) | 是 | 是 | 文本输入类型。|
+| enterKeyType10+ | [EnterKeyType](#enterkeytype10) | 是 | 是 | Enter键功能类型。|
+
+## TextConfig10+
+
+编辑控件配置信息。编辑控件请求绑定输入法应用时传入,将编辑控件相关属性配置信息保存到输入法框架内。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| inputAttribute10+ | [InputAttribute](#inputattribute10) | 是 | 是 | 编辑框属性。|
+
+## CursorInfo10+
+
+光标信息。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| left | number | 是 | 是 | 光标的left坐标。|
+| top | number | 是 | 是 | 光标的top坐标。|
+| width | number | 是 | 是 | 光标的宽度。|
+| height | number | 是 | 是 | 光标的高度。|
+
+## Range10+
+
+描述选中文本的范围。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| start | number | 是 | 是 | 选中文本的首字符在编辑框的索引值。|
+| end | number | 是 | 是 | 选中文本的末字符在编辑框的索引值。|
+
+## Movement10+
+
+描述进行选中文本动作时光标移动的方向。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| direction | [Direction](#direction10) | 是 | 是 | 进行选中文本动作时光标移动的方向。|
+
+## InputMethodController
+
+下列API示例中都需使用[getController](#inputmethodgetcontroller9)获取到InputMethodController实例,再通过此实例调用对应方法。
+
+### attach10+
+
+attach(showKeyboard: boolean, textConfig: TextConfig, callback: AsyncCallback<void>): void
+
+用于自绘控件绑定输入法应用。使用callback异步回调。
+
+必须先调用此接口完成自绘控件与输入法应用的绑定,才可以使用输入法框架的以下功能:显示、隐藏键盘;更新光标信息;更改编辑框选中范围;保存配置信息;监听处理由输入法应用发送的信息或命令等。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| showKeyboard | boolean | 是 | 绑定输入法成功后是否拉起输入法键盘。 |
+| textConfig | [TextConfig](#textconfig10) | 是 | 编辑控件配置信息。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当绑定输入法成功后,err为undefined;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+try {
+ let textConfig: inputMethod.TextConfig = {
+ inputAttribute: {
+ textInputType: 0,
+ enterKeyType: 1
+ }
+ };
+ inputMethodController.attach(true, textConfig, (err) => {
+ if (err) {
+ console.error(`Failed to attach: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in attaching the inputMethod.');
+ });
+} catch(err) {
+ console.error(`Failed to attach: ${JSON.stringify(err)}`);
+}
+```
+
+### attach10+
+
+attach(showKeyboard: boolean, textConfig: TextConfig): Promise<void>
+
+用于自绘控件绑定输入法应用。使用callback异步回调。
+
+必须先调用此接口完成自绘控件与输入法应用的绑定,才可以使用输入法框架的以下功能:显示、隐藏键盘;更新光标信息;更改编辑框选中范围;保存配置信息;监听处理由输入法应用发送的信息或命令等。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| showKeyboard | boolean | 是 | 绑定输入法成功后是否拉起输入法键盘。 |
+| textConfig | [TextConfig](#textconfig10) | 是 | 编辑框属性。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+try {
+ let textConfig: inputMethod.TextConfig = {
+ inputAttribute: {
+ textInputType: 0,
+ enterKeyType: 1
+ }
+ };
+ inputMethodController.attach(true, textConfig).then(() => {
+ console.log('Succeeded in attaching inputMethod.');
+ }).catch((err) => {
+ console.error(`Failed to attach: ${JSON.stringify(err)}`);
+ })
+} catch(err) {
+ console.error(`Failed to attach: ${JSON.stringify(err)}`);
+}
+```
+
+### showTextInput10+
+
+showTextInput(callback: AsyncCallback<void>): void
+
+进入文本编辑状态。使用callback异步回调。
+
+编辑控件与输入法应用绑定成功后,可调用该接口去拉起软键盘。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<void> | 是 | 回调函数。若成功进入编辑状态,err为undefined;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+inputMethodController.showTextInput((err) => {
+ if (err) {
+ console.error(`Failed to showTextInput: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in showing the inputMethod.');
+});
+```
+
+### showTextInput10+
+
+showTextInput(): Promise<void>
+
+进入文本编辑状态。使用promise异步回调。
+
+编辑控件与输入法应用绑定成功后,可调用该接口去拉起软键盘。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+inputMethodController.showTextInput().then(() => {
+ console.log('Succeeded in showing text input.');
+}).catch((err) => {
+ console.error(`Failed to showTextInput: ${JSON.stringify(err)}`);
+});
+```
+
+### hideTextInput10+
+
+hideTextInput(callback: AsyncCallback<void>): void
+
+退出文本编辑状态。使用callback异步回调。
+
+编辑控件可调用该接口退出编辑状态。若调用该接口时当前软键盘处于显示状态,则调用该接口后软键盘会被隐藏。
+
+调用该接口不解除与输入法应用的绑定,再次调用[showTextInput](#showtextinput10)时,可重新进入编辑状态。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<void> | 是 | 回调函数。当成功退出编辑状态时,err为undefined;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+inputMethodController.hideTextInput((err) => {
+ if (err) {
+ console.error(`Failed to hideTextInput: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in hiding text input.');
+});
+```
+
+### hideTextInput10+
+
+hideTextInput(): Promise<void>
+
+退出文本编辑状态。使用promise异步回调。
+
+编辑控件可调用该接口退出编辑状态。若调用该接口时当前软键盘处于显示状态,则调用该接口后软键盘会被隐藏。
+
+调用该接口不解除与输入法应用的绑定,再次调用[showTextInput](#showtextinput10)时,可重新进入编辑状态。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+inputMethodController.hideTextInput().then(() => {
+ console.log('Succeeded in hiding inputMethod.');
+}).catch((err) => {
+ console.error(`Failed to hideTextInput: ${JSON.stringify(err)}`);
+})
+```
+
+### detach10+
+
+detach(callback: AsyncCallback<void>): void
+
+解除与输入法应用的绑定。使用callback异步回调。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<void> | 是 | 回调函数。当解绑定输入法成功时,err为undefined;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+inputMethodController.detach((err) => {
+ if (err) {
+ console.error(`Failed to detach: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in detaching inputMethod.');
+});
+```
+
+### detach10+
+
+detach(): Promise<void>
+
+解除与输入法应用的绑定。使用promise异步回调。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+inputMethodController.detach().then(() => {
+ console.log('Succeeded in detaching inputMethod.');
+}).catch((err) => {
+ console.error(`Failed to detach: ${JSON.stringify(err)}`);
+});
+```
+
+### setCallingWindow10+
+
+setCallingWindow(windowId: number, callback: AsyncCallback<void>): void
+
+设置要避让的窗口。使用callback异步回调。
+
+比如:将当前绑定到输入法的应用程序的窗口ID通知系统,正确设置后,客户端所在的窗口可以避开输入法窗口。预留能力,当前暂不支持获取windowId。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| windowId | number | 是 | 要避让的窗口id。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当设置成功时,err为undefined;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+try {
+ let windowId: number = 2000;
+ inputMethodController.setCallingWindow(windowId, (err) => {
+ if (err) {
+ console.error(`Failed to setCallingWindow: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in setting callingWindow.');
+ });
+} catch(err) {
+ console.error(`Failed to setCallingWindow: ${JSON.stringify(err)}`);
+}
+```
+
+### setCallingWindow10+
+
+setCallingWindow(windowId: number): Promise<void>
+
+设置要避让的窗口。使用promise异步回调。
+
+比如:将当前绑定到输入法的应用程序的窗口ID通知系统,正确设置后,客户端所在的窗口可以避开输入法窗口。预留能力,当前暂不支持获取windowId。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| windowId | number | 是 | 要避让的窗口id。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+try {
+ let windowId: number = 2000;
+ inputMethodController.setCallingWindow(windowId).then(() => {
+ console.log('Succeeded in setting callingWindow.');
+ }).catch((err) => {
+ console.error(`Failed to setCallingWindow: ${JSON.stringify(err)}`);
+ })
+} catch(err) {
+ console.error(`Failed to setCallingWindow: ${JSON.stringify(err)}`);
+}
+```
+
+### updateCursor10+
+
+updateCursor(cursorInfo: CursorInfo, callback: AsyncCallback<void>): void
+
+更新当前编辑框内光标信息。使用callback异步回调。
+
+当光标信息发生变化时,可调用该接口更新光标信息,从而被输入法应用感知到光标变化。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| cursorInfo | [CursorInfo](#cursorinfo10) | 是 | 光标信息。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当光标信息更新成功时,err为undefined;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+try {
+ inputMethodController.updateCursor({left: 0, top: 0, width: 600, height: 800}, (err) => {
+ if (err) {
+ console.error(`Failed to updateCursor: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in updating cursorInfo.');
+ });
+} catch(err) {
+ console.error(`Failed to updateCursor: ${JSON.stringify(err)}`);
+}
+```
+
+### updateCursor10+
+
+updateCursor(cursorInfo: CursorInfo): Promise<void>
+
+更新当前编辑控件内的光标信息。使用promise异步回调。
+
+当光标信息发生变化时,编辑控件可调用该接口更新光标信息,从而被输入法应用感知到光标变化。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| cursorInfo | [CursorInfo](#cursorinfo10) | 是 | 光标信息。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+try {
+ inputMethodController.updateCursor({left: 0, top: 0, width: 600, height: 800}).then(() => {
+ console.log('Succeeded in updating cursorInfo.');
+ }).catch((err) => {
+ console.error(`Failed to updateCursor: ${JSON.stringify(err)}`);
+ })
+} catch(err) {
+ console.error(`Failed to updateCursor: ${JSON.stringify(err)}`);
+}
+```
+
+### changeSelection10+
+
+changeSelection(text: string, start: number, end: number, callback: AsyncCallback<void>): void
+
+向输入法应用更新当前编辑框内被选中的文本信息,当选中的文本内容或文本范围发生变化时,可调用该接口更新文本信息。使用callback异步回调。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| text | string | 是 | 整个输入文本。 |
+| start | number | 是 | 所选文本的起始位置。 |
+| end | number | 是 | 所选文本的结束位置。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当隐藏输入法成功时,err为undefined;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+try {
+ inputMethodController.changeSelection('text', 0, 5, (err) => {
+ if (err) {
+ console.error(`Failed to changeSelection: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in changing selection.');
+ });
+} catch(err) {
+ console.error(`Failed to changeSelection: ${JSON.stringify(err)}`);
+}
+```
+
+### changeSelection10+
+
+changeSelection(text: string, start: number, end: number): Promise<void>
+
+向输入法应用更新当前编辑框内被选中的文本信息,当选中的文本内容或文本范围发生变化时,可调用该接口更新文本信息。使用promise异步回调。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| text | string | 是 | 整个输入文本。 |
+| start | number | 是 | 所选文本的起始位置。 |
+| end | number | 是 | 所选文本的结束位置。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+try {
+ inputMethodController.changeSelection('test', 0, 5).then(() => {
+ console.log('Succeeded in changing selection.');
+ }).catch((err) => {
+ console.error(`Failed to changeSelection: ${JSON.stringify(err)}`);
+ })
+} catch(err) {
+ console.error(`Failed to changeSelection: ${JSON.stringify(err)}`);
+}
+```
+
+### updateAttribute10+
+
+updateAttribute(attribute: InputAttribute, callback: AsyncCallback<void>): void
+
+更新编辑框属性配置信息。使用callback异步回调。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| attribute | [InputAttribute](#inputattribute10) | 是 | InputAttribute对象,包含的额外信息。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当隐藏输入法成功时,err为undefined;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+try {
+ inputMethodController.updateAttribute({textInputType: 0, enterKeyType: 1}, (err) => {
+ if (err) {
+ console.error(`Failed to updateAttribute: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in updating attribute.');
+ });
+} catch(err) {
+ console.error(`Failed to updateAttribute: ${JSON.stringify(err)}`);
+}
+```
+
+### updateAttribute10+
+
+updateAttribute(attribute: InputAttribute): Promise<void>
+
+更新编辑框属性配置信息。使用promise异步回调。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| attribute | [InputAttribute](#inputattribute10) | 是 | InputAttribute对象,包含的额外信息。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
+
+**示例:**
+
+```js
+try {
+ inputMethodController.updateAttribute({textInputType: 0, enterKeyType: 1}).then(() => {
+ console.log('Succeeded in updating attribute.');
+ }).catch((err) => {
+ console.error(`Failed to updateAttribute: ${JSON.stringify(err)}`);
+ })
+} catch(err) {
+ console.error(`Failed to updateAttribute: ${JSON.stringify(err)}`);
+}
+```
+
+### stopInputSession9+
+
+stopInputSession(callback: AsyncCallback<boolean>): void
+
+结束输入会话。使用callback异步回调。
+
+需要与编辑控件(如:输入框)绑定使用。当点击编辑控件后,才可通过调用该接口结束输入会话。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<boolean> | 是 | 回调函数。当结束输入会话成功时,err为undefined,data为true;否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+try {
+ inputMethodController.stopInputSession((err, result) => {
+ if (err) {
+ console.error(`Failed to stopInputSession: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in stopping inputSession.');
+ } else {
+ console.error('Failed to stopInputSession.');
+ }
+ });
+} catch(err) {
+ console.error(`Failed to stopInputSession: ${JSON.stringify(err)}`);
+}
+```
+
+### stopInputSession9+
+
+stopInputSession(): Promise<boolean>
+
+结束输入会话。使用promise异步回调。
+
+需要与编辑控件(如:输入框)绑定使用。当点击编辑控件后,才可通过调用该接口结束输入会话。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<boolean> | Promise对象。返回true表示结束输入会话成功;返回false表示结束输入会话失败。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+try {
+ inputMethodController.stopInputSession().then((result) => {
+ if (result) {
+ console.log('Succeeded in stopping inputSession.');
+ } else {
+ console.error('Failed to stopInputSession.');
+ }
+ }).catch((err) => {
+ console.error(`Failed to stopInputSession: ${JSON.stringify(err)}`);
+ })
+} catch(err) {
+ console.error(`Failed to stopInputSession: ${JSON.stringify(err)}`);
+}
+```
+
+### showSoftKeyboard9+
+
+showSoftKeyboard(callback: AsyncCallback<void>): void
+
+显示软键盘。使用callback异步回调。
+
+需要与编辑控件(如:输入框)绑定使用。当点击编辑控件后,才可通过该接口的调用显示出当前输入法的软键盘。
+
+**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------------------------- | ---- | ---------- |
+| callback | AsyncCallback<void> | 是 | 回调函数。当软键盘显示成功。err为undefined,否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+inputMethodController.showSoftKeyboard((err) => {
+ if (!err) {
+ console.log('Succeeded in showing softKeyboard.');
+ } else {
+ console.error(`Failed to show softKeyboard: ${JSON.stringify(err)}`);
+ }
+})
+```
+
+### showSoftKeyboard9+
+
+showSoftKeyboard(): Promise<void>
+
+显示软键盘。使用Promise异步回调。
+
+需要与编辑控件(如:输入框)绑定使用。当点击编辑控件后,才可通过该接口的调用显示出当前输入法的软键盘。
+
+**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------- | ------------------------- |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+inputMethodController.showSoftKeyboard().then(() => {
+ console.log('Succeeded in showing softKeyboard.');
+}).catch((err) => {
+ console.error(`Failed to show softKeyboard: ${JSON.stringify(err)}`);
+});
+```
+
+### hideSoftKeyboard9+
+
+hideSoftKeyboard(callback: AsyncCallback<void>): void
+
+隐藏软键盘。使用callback异步回调。
+
+需要与编辑控件(如:输入框)绑定使用。当点击编辑控件后,才可通过调用该接口隐藏当前输入法的软键盘。
+
+**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------------------------- | ---- | ---------- |
+| callback | AsyncCallback<void> | 是 | 回调函数。当软键盘隐藏成功。err为undefined,否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+inputMethodController.hideSoftKeyboard((err) => {
+ if (!err) {
+ console.log('Succeeded in hiding softKeyboard.');
+ } else {
+ console.error(`Failed to hide softKeyboard: ${JSON.stringify(err)}`);
+ }
+})
+```
+
+### hideSoftKeyboard9+
+
+hideSoftKeyboard(): Promise<void>
+
+隐藏软键盘。使用Promise异步回调。
+
+需要与编辑控件(如:输入框)绑定使用。当点击编辑控件后,才可通过调用该接口隐藏当前输入法的软键盘。
+
+**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------- | ------------------------- |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800003 | Input method client error. |
+| 12800008 | Input method manager service error. |
+
+**示例:**
+
+```js
+inputMethodController.hideSoftKeyboard().then(() => {
+ console.log('Succeeded in hiding softKeyboard.');
+}).catch((err) => {
+ console.error(`Failed to hide softKeyboard: ${JSON.stringify(err)}`);
+});
+```
+
+### stopInput(deprecated)
+
+stopInput(callback: AsyncCallback<boolean>): void
+
+结束输入会话。使用callback异步回调。
+
+需要与编辑控件(如:输入框)绑定使用。当点击编辑控件后,才可通过调用该接口结束输入会话。
+
+> **说明:**
+>
+> 从API version 6开始支持,从API version 9开始废弃,建议使用[stopInputSession()](#stopinputsession9)替代。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<boolean> | 是 | 回调函数。当输入法隐藏成功,err为undefined,data为true;否则为错误对象。 |
+
+**示例:**
+
+```js
+inputMethodController.stopInput((err, result) => {
+ if (err) {
+ console.error(`Failed to stopInput: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in stopping input.');
+ } else {
+ console.error('Failed to stopInput.');
+ }
+});
+```
+
+### stopInput(deprecated)
+
+stopInput(): Promise<boolean>
+
+结束输入会话。使用promise异步回调。
+
+需要与编辑控件(如:输入框)绑定使用。当点击编辑控件后,才可通过调用该接口结束输入会话。
+
+> **说明:**
+>
+> 从API version 6开始支持,从API version 9开始废弃,建议使用[stopInputSession()](#stopinputsession9)替代。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<boolean> | Promise对象。返回true表示输入法隐藏成功;返回false表示输入法隐藏失败。 |
+
+**示例:**
+
+```js
+inputMethodController.stopInput().then((result) => {
+ if (result) {
+ console.log('Succeeded in stopping input.');
+ } else {
+ console.error('Failed to stopInput.');
+ }
+}).catch((err) => {
+ console.error(`Failed to stopInput: ${JSON.stringify(err)}`);
+})
+```
+
+### on('insertText')10+
+
+on(type: 'insertText', callback: (text: string) => void): void;
-**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
+订阅输入法应用插入文本事件。使用callback异步回调。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | -------- | -------- | -------- |
-|inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| 是 | 传入要切换的目标输入法。 |
-|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| 是 | 传入要切换的目标输入法子类型。 |
-| callback | AsyncCallback<boolean> | 是 | 回调函数。当输入法和子类型切换成功,err为undefined,data为获取到的切换子类型结果true;否则为错误对象。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 设置监听类型。 - type为‘insertText’时表示订阅输入法应用插入文本事件监听。 |
+| callback | (text: string) => void | 是 | 回调函数,返回需要插入的文本内容。 开发者需要在回调函数中根据传入的文本内容操作编辑框中的内容。 |
**错误码:**
@@ -385,53 +1644,54 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
| 错误码ID | 错误信息 |
| -------- | -------------------------------------- |
-| 12800005 | Configuration persisting error. |
-| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
**示例:**
```js
-let im = inputMethod.getCurrentInputMethod();
-let imSubType = inputMethod.getCurrentInputMethodSubtype();
try {
- inputMethod.switchCurrentInputMethodAndSubtype(im, imSubType, (err,result) => {
- if (err !== undefined) {
- console.error('Failed to switchCurrentInputMethodAndSubtype: ' + JSON.stringify(err));
- return;
- }
- if (result) {
- console.info('Succeeded in switching currentInputMethodAndSubtype.');
- } else {
- console.error('Failed to switchCurrentInputMethodAndSubtype.');
- }
- });
-} catch (err) {
- console.error('Failed to switchCurrentInputMethodAndSubtype: ' + JSON.stringify(err));
+ inputMethodController.on('insertText', (text) => {
+ console.log(`Succeeded in subscribing insertText: ${text}`);
+ });
+} catch(err) {
+ console.error(`Failed to subscribe insertText: ${JSON.stringify(err)}`);
}
```
-## inputMethod.switchCurrentInputMethodAndSubtype9+
-
-switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype): Promise<boolean>
+### off('insertText')10+
-切换至指定输入法应用的指定子类型,用于跨输入法应用切换子类型。使用promise异步回调。
+off(type: 'insertText'): void
-**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
+取消订阅输入法应用插入文本事件。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | -------- | -------- | -------- |
-|inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| 是 | 传入要切换的目标输入法。 |
-|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| 是 | 传入要切换的目标输入法子类型。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 设置监听类型。 - type为‘insertText’时表示取消订阅输入法应用插入文本事件监听。 |
-**返回值:**
+**示例:**
-| 类型 | 说明 |
-| ----------------------------------------- | ---------------------------- |
-| Promise\ | Promise对象。返回true表示切换至指定输入法应用的指定子类型成功;返回false表示切换至指定输入法应用的指定子类型失败。 |
+```js
+inputMethodController.off('insertText');
+```
+
+### on('deleteLeft' | 'deleteRight')10+
+
+on(type: 'deleteLeft' | 'deleteRight', callback: (length: number) => void): void
+
+订阅输入法应用向左删除或向右删除事件。使用callback异步回调。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----- | ---- | ----- |
+| type | string | 是 | 设置监听类型。 - type为‘deleteLeft’时表示订阅输入法应用向左删除事件监听。 - type为‘deleteRight’时表示订阅输入法应用向右删除事件监听。|
+| callback | (length: number) => void | 是 | 回调函数,返回需要向左或向右删除的文本的长度。 开发者需要在回调函数中根据传入的删除长度操作编辑框中相应文本。 |
**错误码:**
@@ -439,94 +1699,63 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp
| 错误码ID | 错误信息 |
| -------- | -------------------------------------- |
-| 12800005 | Configuration persisting error. |
-| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
**示例:**
```js
-let im = inputMethod.getCurrentInputMethod();
-let imSubType = inputMethod.getCurrentInputMethodSubtype();
try {
- inputMethod.switchCurrentInputMethodAndSubtype(im, imSubType).then((result) => {
- if (result) {
- console.info('Succeeded in switching currentInputMethodAndSubtype.');
- } else {
- console.error('Failed to switchCurrentInputMethodAndSubtype.');
- }
- }).catch((err) => {
- console.error('Failed to switchCurrentInputMethodAndSubtype: ' + JSON.stringify(err));
- })
+ inputMethodController.on('deleteLeft', (length) => {
+ console.log(`Succeeded in subscribing deleteLeft, length: ${length}`);
+ });
} catch(err) {
- console.error('Failed to switchCurrentInputMethodAndSubtype: ' + JSON.stringify(err));
+ console.error(`Failed to subscribe deleteLeft: ${JSON.stringify(err)}`);
}
-```
-
-## inputMethod.getInputMethodController(deprecated)
-
-getInputMethodController(): InputMethodController
-获取客户端实例[InputMethodController](#inputmethodcontroller)。
-
-> **说明:**
->
-> 从API version 6开始支持,从API version 9开始废弃, 建议使用[getController()](#inputmethodgetcontroller9)替代。
-
-**系统能力:** SystemCapability.MiscServices.InputMethodFramework
-
-**返回值:**
-
-| 类型 | 说明 |
-| ----------------------------------------------- | ------------------------ |
-| [InputMethodController](#inputmethodcontroller) | 回调返回当前客户端实例。 |
-
-**示例:**
-
-```js
-let inputMethodController = inputMethod.getInputMethodController();
+try {
+ inputMethodController.on('deleteRight', (length) => {
+ console.log(`Succeeded in subscribing deleteRight, length: ${length}`);
+ });
+} catch(err) {
+ console.error(`Failed to subscribe deleteRight: ${JSON.stringify(err)}`);
+}
```
-## inputMethod.getInputMethodSetting(deprecated)
-
-getInputMethodSetting(): InputMethodSetting
+### off('deleteLeft' | 'deleteRight')10+
-获取客户端设置实例[InputMethodSetting](#inputmethodsetting8)。
+off(type: 'deleteLeft' | 'deleteRight'): void
-> **说明:**
->
-> 从API version 6开始支持,从API version 9开始废弃, 建议使用[getSetting()](#inputmethodgetsetting9)替代。
+取消订阅输入法应用向左或向右删除文本事件。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
-**返回值:**
+**参数:**
-| 类型 | 说明 |
-| ----------------------------------------- | ---------------------------- |
-| [InputMethodSetting](#inputmethodsetting8) | 回调返回当前客户端设置实例。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 设置监听类型。 - type为‘deleteLeft’时表示取消订阅输入法应用向左删除的事件监听。 - type为‘deleteRight’时表示取消订阅输入法应用向右删除的事件监听。|
**示例:**
```js
-let inputMethodSetting = inputMethod.getInputMethodSetting();
+inputMethodController.off('deleteLeft');
+inputMethodController.off('deleteRight');
```
-## InputMethodController
-
-下列API示例中都需使用[getController](#inputmethodgetcontroller9)获取到InputMethodController实例,再通过此实例调用对应方法。
-
-### stopInputSession9+
+### on('sendKeyboardStatus')10+
-stopInputSession(callback: AsyncCallback<boolean>): void
+on(type: 'sendKeyboardStatus', callback: (keyBoardStatus: KeyboardStatus) => void): void
-结束输入会话。通过点击输入框实现输入会话的开启之后该接口的调用才可生效。使用callback异步回调。
+订阅输入法应用发送键盘状态事件。使用callback异步回调。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback<boolean> | 是 | 回调函数。当结束输入会话成功时,err为undefined,data为true;否则为错误对象。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | ---- |
+| type | string | 是 | 设置监听类型。 - type为‘sendKeyboardStatus’时表示订阅输入法应用发送键盘状态事件监听。 |
+| callback | (keyBoardStatus: [KeyboardStatus](#keyboardstatus10)) => void | 是 | 回调函数,返回键盘状态。 开发者需要在回调函数中根据传入的键盘状态做相应动作。 |
**错误码:**
@@ -534,85 +1763,54 @@ stopInputSession(callback: AsyncCallback<boolean>): void
| 错误码ID | 错误信息 |
| -------- | -------------------------------------- |
-| 12800003 | Input method client error. |
-| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
**示例:**
```js
try {
- inputMethodController.stopInputSession((error, result) => {
- if (error !== undefined) {
- console.error('Failed to stopInputSession: ' + JSON.stringify(error));
- return;
- }
- if (result) {
- console.info('Succeeded in stopping inputSession.');
- } else {
- console.error('Failed to stopInputSession.');
- }
- });
-} catch(error) {
- console.error('Failed to stopInputSession: ' + JSON.stringify(error));
+ inputMethodController.on('sendKeyboardStatus', (keyBoardStatus) => {
+ console.log(`Succeeded in subscribing sendKeyboardStatus, keyBoardStatus: ${keyBoardStatus}`);
+ });
+} catch(err) {
+ console.error(`Failed to subscribe sendKeyboardStatus: ${JSON.stringify(err)}`);
}
```
-### stopInputSession9+
+### off('sendKeyboardStatus')10+
-stopInputSession(): Promise<boolean>
+off(type: 'sendKeyboardStatus'): void
-结束输入会话。通过点击输入框实现输入会话的开启之后此接口才可生效。使用promise异步回调。
+取消订阅输入法应用发送键盘状态事件。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
-**返回值:**
-
-| 类型 | 说明 |
-| -------- | -------- |
-| Promise<boolean> | Promise对象。返回true表示结束输入会话成功;返回false表示结束输入会话失败。 |
-
-**错误码:**
-
-以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+**参数:**
-| 错误码ID | 错误信息 |
-| -------- | -------------------------------------- |
-| 12800003 | Input method client error. |
-| 12800008 | Input method manager service error. |
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 设置监听类型。 - type为‘sendKeyboardStatus’时表示取消订阅输入法应用发送键盘状态事件监听。 |
**示例:**
```js
-try {
- inputMethodController.stopInputSession().then((result) => {
- if (result) {
- console.info('Succeeded in stopping inputSession.');
- } else {
- console.error('Failed to stopInputSession.');
- }
- }).catch((err) => {
- console.error('Failed to stopInputSession: ' + JSON.stringify(err));
- })
-} catch(err) {
- console.error('Failed to stopInputSession: ' + JSON.stringify(err));
-}
+inputMethodController.off('sendKeyboardStatus');
```
-### showSoftKeyboard9+
-
-showSoftKeyboard(callback: AsyncCallback<void>): void
+### on('sendFunctionKey')10+
-显示软键盘。需要与输入框绑定使用。当点击输入框后,才可通过该接口的调用显示出当前输入法的软键盘。使用callback异步回调。
+on(type: 'sendFunctionKey', callback: (functionKey: FunctionKey) => void): void
-**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
+订阅输入法应用发送功能键事件。使用callback异步回调。
-**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ------------------------- | ---- | ---------- |
-| callback | AsyncCallback<void> | 是 | 回调函数。当软键盘显示成功。err为undefined,否则为错误对象。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | ---- | ----- |
+| type | string | 是 | 设置监听类型。 - type为‘sendFunctionKey’时表示订阅输入法应用发送功能键事件监听。 |
+| callback | (functionKey: [FunctionKey](#functionkey10)) => void | 是 | 回调函数,返回输入法应用发送的功能键信息。 开发者需要根据返回的功能键做相应的操作。 |
**错误码:**
@@ -620,192 +1818,148 @@ showSoftKeyboard(callback: AsyncCallback<void>): void
| 错误码ID | 错误信息 |
| -------- | -------------------------------------- |
-| 12800003 | Input method client error. |
-| 12800008 | Input method manager service error. |
+| 12800009 | Input method client is detached. |
**示例:**
```js
-inputMethodController.showSoftKeyboard((err) => {
- if (err === undefined) {
- console.info('Succeeded in showing softKeyboard.');
- } else {
- console.error('Failed to showSoftKeyboard: ' + JSON.stringify(err));
- }
-})
+try {
+ inputMethodController.on('sendFunctionKey', (functionKey) => {
+ console.log(`Succeeded in subscribing sendFunctionKey, functionKey.enterKeyType: ${functionKey.enterKeyType}`);
+ });
+} catch(err) {
+ console.error(`Failed to subscribe sendFunctionKey: ${JSON.stringify(err)}`);
+}
```
-### showSoftKeyboard9+
-
-showSoftKeyboard(): Promise<void>
-
-显示软键盘。需要与输入框绑定使用。当点击输入框后,才可通过该接口的调用显示出当前输入法的软键盘。使用Promise异步回调。
-
-**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
-
-**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+### off('sendFunctionKey')10+
-**返回值:**
+off(type: 'sendFunctionKey'): void
-| 类型 | 说明 |
-| ------------------- | ------------------------- |
-| Promise<void> | 无返回结果的Promise对象。 |
+取消订阅输入法应用发送FunctionKey事件。
-**错误码:**
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
-以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+**参数:**
-| 错误码ID | 错误信息 |
-| -------- | -------------------------------------- |
-| 12800003 | Input method client error. |
-| 12800008 | Input method manager service error. |
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------------------------------------------------------------ |
+| type | string | 是 | 设置监听类型。 - type为‘sendFunctionKey’时表示取消订阅输入法应用发送FunctionKey事件监听。 |
**示例:**
```js
-inputMethodController.showSoftKeyboard().then(() => {
- console.log('Succeeded in showing softKeyboard.');
-}).catch((err) => {
- console.error('Failed to showSoftKeyboard: ' + JSON.stringify(err));
-});
+inputMethodController.off('sendFunctionKey');
```
-### hideSoftKeyboard9+
-
-hideSoftKeyboard(callback: AsyncCallback<void>): void
+### on('moveCursor')10+
-隐藏软键盘。需要与输入框绑定使用。点击输入框后,才可以使用该接口的调用隐藏软键盘。使用callback异步回调。
+on(type: 'moveCursor', callback: (direction: Direction) => void): void
-**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
+订阅输入法应用移动光标事件。使用callback异步回调。
-**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ------------------------- | ---- | ---------- |
-| callback | AsyncCallback<void> | 是 | 回调函数。当软键盘隐藏成功。err为undefined,否则为错误对象。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | ------ |
+| type | string | 是 | 设置监听类型。 - type为‘moveCursor’时表示订阅输入法应用移动光标事件监听。 |
+| callback | callback: (direction: [Direction10+ ](#direction10)) => void | 是 | 回调函数,返回光标信息。 开发者需要根据返回的光标移动方向改变光标位置。 |
**错误码:**
以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
-| 错误码ID | 错误信息 |
-| -------- | -------------------------------------- |
-| 12800003 | Input method client error. |
-| 12800008 | Input method manager service error. |
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------- |
+| 12800009 | Input method client is detached. |
**示例:**
```js
-inputMethodController.hideSoftKeyboard((err) => {
- if (err === undefined) {
- console.info('Succeeded in hiding softKeyboard.');
- } else {
- console.error('Failed to hideSoftKeyboard: ' + JSON.stringify(err));
- }
-})
+try {
+ inputMethodController.on('moveCursor', (direction) => {
+ console.log(`Succeeded in subscribing moveCursor, direction: ${direction}`);
+ });
+} catch(err) {
+ console.error(`Failed to subscribe moveCursor: ${JSON.stringify(err)}`);
+}
```
-### hideSoftKeyboard9+
-
-hideSoftKeyboard(): Promise<void>
-
-隐藏软键盘。需要与输入框绑定使用。点击输入框后,才可以使用该接口的调用隐藏软键盘。使用Promise异步回调。
-
-**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
-
-**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+### off('moveCursor')10+
-**返回值:**
+off(type: 'moveCursor'): void
-| 类型 | 说明 |
-| ------------------- | ------------------------- |
-| Promise<void> | 无返回结果的Promise对象。 |
+取消订阅输入法应用移动光标事件。
-**错误码:**
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
-以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+**参数:**
-| 错误码ID | 错误信息 |
-| -------- | -------------------------------------- |
-| 12800003 | Input method client error. |
-| 12800008 | Input method manager service error. |
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ---- |
+| type | string | 是 | 设置监听类型。 - type为‘moveCursor’时表示取消订阅输入法应用发送移动光标事件监听。 |
**示例:**
```js
-inputMethodController.hideSoftKeyboard().then(() => {
- console.log('Succeeded in hiding softKeyboard.');
-}).catch((err) => {
- console.error('Failed to hideSoftKeyboard: ' + JSON.stringify(err));
-});
+inputMethodController.off('moveCursor');
```
-### stopInput(deprecated)
-
-stopInput(callback: AsyncCallback<boolean>): void
+### on('handleExtendAction')10+
-结束输入会话。通过点击输入框实现输入会话的开启之后该接口的调用才可生效。使用callback异步回调。
+on(type: 'handleExtendAction', callback: (action: ExtendAction) => void): void
-> **说明:**
->
-> 从API version 6开始支持,从API version 9开始废弃, 建议使用[stopInputSession()](#stopinputsession9)替代。
+订阅输入法应用发送扩展操作事件。使用callback异步回调。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback<boolean> | 是 | 回调函数。当输入法隐藏成功,err为undefined,data为true;否则为错误对象。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | -------- |
+| type | string | 是 | 设置监听类型。 - type为‘handleExtendAction’时表示订阅输入法应用发送扩展操作代码事件监听。 |
+| callback | callback: (action: [ExtendAction](#extendaction10)) => void | 是 | 回调函数,返回扩展操作类型。 开发者需要在回调函数中根据传入的扩展操作类型做相应的操作。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | -------------------------------------- |
+| 12800009 | Input method client is detached. |
**示例:**
```js
-inputMethodController.stopInput((error, result) => {
- if (error !== undefined) {
- console.error('Failed to stopInput: ' + JSON.stringify(error));
- return;
- }
- if (result) {
- console.info('Succeeded in stopping input.');
- } else {
- console.error('Failed to stopInput.');
- }
-});
+try {
+ inputMethodController.on('handleExtendAction', (action) => {
+ console.log(`Succeeded in subscribing handleExtendAction, action: ${action}`);
+ });
+} catch(err) {
+ console.error(`Failed to subscribe handleExtendAction: ${JSON.stringify(err)}`);
+}
```
-### stopInput(deprecated)
-
-stopInput(): Promise<boolean>
+### off('handleExtendAction')10+
-结束输入会话。通过点击输入框实现输入会话的开启之后该接口的调用才可生效。使用promise异步回调。
+off(type: 'handleExtendAction'): void
-> **说明:**
->
-> 从API version 6开始支持,从API version 9开始废弃, 建议使用[stopInputSession()](#stopinputsession9)替代。
+取消订阅输入法应用发送扩展操作事件。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
-**返回值:**
+**参数:**
-| 类型 | 说明 |
-| -------- | -------- |
-| Promise<boolean> | Promise对象。返回true表示输入法隐藏成功;返回false表示输入法隐藏失败。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------- |
+| type | string | 是 | 设置监听类型。 - type为‘handleExtendAction’时表示取消订阅输入法应用发送扩展代码事件监听。 |
**示例:**
```js
-inputMethodController.stopInput().then((result) => {
- if (result) {
- console.info('Succeeded in stopping input.');
- } else {
- console.error('Failed to stopInput.');
- }
-}).catch((err) => {
- console.error('Failed to stopInput: ' + err);
-})
+inputMethodController.off('handleExtendAction');
```
### on('selectByRange')10+
@@ -818,16 +1972,16 @@ on(type: 'selectByRange', callback: Callback<Range>): void
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 设置监听类型。 -type为‘selectByRange’时表示订阅输入法应用按范围选中文本事件监听。 |
-| callback | Callback<[Range](./js-apis-inputmethod-InputMethodCommon.md#range)> | 是 | 回调函数,返回需要选中的文本的范围。 开发者需要在回调函数中根据传入的范围选中编辑框中相应文本。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---- | ---- | ------- |
+| type | string | 是 | 设置监听类型。 - type为‘selectByRange’时表示订阅输入法应用按范围选中文本事件监听。 |
+| callback | Callback<[Range](#range10)> | 是 | 回调函数,返回需要选中的文本的范围。 开发者需要在回调函数中根据传入的范围选中编辑框中相应文本。 |
**示例:**
```js
inputMethodController.on('selectByRange', (range) => {
- console.info('Succeeded in subscribing selectByRange: start: ' + range.start + " , end: " + range.end);
+ console.log(`Succeeded in subscribing selectByRange: start: ${range.start} , end: ${range.end}`);
});
```
@@ -843,7 +1997,7 @@ off(type: 'selectByRange'): void
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 设置监听类型。 -type为‘selectByRange’时表示取消订阅输入法应用按范围选中文本事件监听。 |
+| type | string | 是 | 设置监听类型。 - type为‘selectByRange’时表示取消订阅输入法应用按范围选中文本事件监听。 |
**示例:**
@@ -861,16 +2015,16 @@ on(type: 'selectByMovement', callback: Callback<Movement>): void
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 设置监听类型。 -type为‘selectByMovement’时表示订阅输入法应用按光标移动动作选中文本事件监听。 |
-| callback | Callback<[Movement](./js-apis-inputmethod-InputMethodCommon.md#movement)> | 是 | 回调函数,返回需要选中的文本的范围。 开发者需要在回调函数中根据传入的光标动作选中编辑框中相应文本。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----- | ---- | ------ |
+| type | string | 是 | 设置监听类型。 - type为‘selectByMovement’时表示订阅输入法应用按光标移动动作选中文本事件监听。 |
+| callback | Callback<[Movement](#movement10)> | 是 | 回调函数,返回需要选中的文本的范围。 开发者需要在回调函数中根据传入的光标动作选中编辑框中相应文本。 |
**示例:**
```js
inputMethodController.on('selectByMovement', (movement) => {
- console.info('Succeeded in subscribing selectByMovement: direction: ' + movement.direction);
+ console.log('Succeeded in subscribing selectByMovement: direction: ' + movement.direction);
});
```
@@ -886,7 +2040,7 @@ off(type: 'selectByMovement'): void
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 设置监听类型。 -type为‘selectByMovement’时表示取消订阅输入法应用按范围选中文本事件监听。 |
+| type | string | 是 | 设置监听类型。 - type为‘selectByMovement’时表示取消订阅输入法应用按范围选中文本事件监听。 |
**示例:**
@@ -910,14 +2064,14 @@ on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, input
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 设置监听类型。 -type为‘imeChange’时表示订阅输入法及子类型变化监听事件。 |
+| type | string | 是 | 设置监听类型。 - type为‘imeChange’时表示订阅输入法及子类型变化监听事件。 |
| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)) => void | 是 | 回调函数,返回输入法属性对象及输入法子类型对象。 |
**示例:**
```js
inputMethodSetting.on('imeChange', (inputMethodProperty, inputMethodSubtype) => {
- console.info('Succeeded in subscribing imeChange: inputMethodProperty: ' + JSON.stringify(inputMethodProperty) + " , inputMethodSubtype: " + JSON.stringify(inputMethodSubtype));
+ console.log('Succeeded in subscribing imeChange: inputMethodProperty: ' + JSON.stringify(inputMethodProperty) + " , inputMethodSubtype: " + JSON.stringify(inputMethodSubtype));
});
```
@@ -931,9 +2085,9 @@ off(type: 'imeChange', callback?: (inputMethodProperty: InputMethodProperty, inp
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 设置监听类型。 -type为‘imeChange’时表示取消订阅输入法及子类型变化监听事件。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------- | ---- | --------------- |
+| type | string | 是 | 设置监听类型。 - type为‘imeChange’时表示取消订阅输入法及子类型变化监听事件。 |
| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)) => void | 否 | 回调函数,返回取消订阅的输入法属性对象及输入法子类型对象。 |
**示例:**
@@ -954,7 +2108,7 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: Async
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------------- | ---- | ---------------------- |
-| inputMethodProperty | InputMethodProperty| 是 | 子类型所属的输入法应用。 |
+| inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| 是 | 子类型所属的输入法应用。 |
| callback | AsyncCallback<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>> | 是 | 回调函数,返回指定输入法应用的所有子类型。 |
**错误码:**
@@ -970,22 +2124,19 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: Async
```js
let inputMethodProperty = {
- packageName: 'com.example.kikakeyboard',
- methodId: 'com.example.kikakeyboard',
- name: 'com.example.kikakeyboard',
- id: 'com.example.kikakeyboard',
- extra:{}
+ name: 'com.example.kikakeyboard',
+ id: 'propertyId',
}
try {
- inputMethodSetting.listInputMethodSubtype(inputMethodProperty, (err,data) => {
- if (err !== undefined) {
- console.error('Failed to listInputMethodSubtype: ' + JSON.stringify(err));
- return;
- }
- console.log('Succeeded in listing inputMethodSubtype.');
- });
+ inputMethodSetting.listInputMethodSubtype(inputMethodProperty, (err, data) => {
+ if (err) {
+ console.error(`Failed to listInputMethodSubtype: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in listing inputMethodSubtype.');
+ });
} catch (err) {
- console.error('Failed to listInputMethodSubtype: ' + JSON.stringify(err));
+ console.error(`Failed to listInputMethodSubtype: ${JSON.stringify(err)}`);
}
```
@@ -1001,7 +2152,7 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise<Arr
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------------- | ---- | ---------------------- |
-| inputMethodProperty | InputMethodProperty| 是 | 子类型所属的输入法应用。 |
+| inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| 是 | 子类型所属的输入法应用。 |
**返回值:**
@@ -1022,20 +2173,17 @@ listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise<Arr
```js
let inputMethodProperty = {
- packageName: 'com.example.kikakeyboard',
- methodId: 'com.example.kikakeyboard',
- name: 'com.example.kikakeyboard',
- id: 'com.example.kikakeyboard',
- extra:{}
+ name: 'com.example.kikakeyboard',
+ id: 'propertyId',
}
try {
- inputMethodSetting.listInputMethodSubtype(inputMethodProperty).then((data) => {
- console.info('Succeeded in listing inputMethodSubtype.');
- }).catch((err) => {
- console.error('Failed to listInputMethodSubtype: ' + JSON.stringify(err));
- })
+ inputMethodSetting.listInputMethodSubtype(inputMethodProperty).then((data) => {
+ console.log('Succeeded in listing inputMethodSubtype.');
+ }).catch((err) => {
+ console.error(`Failed to listInputMethodSubtype: ${JSON.stringify(err)}`);
+ })
} catch(err) {
- console.error('Failed to listInputMethodSubtype: ' + JSON.stringify(err));
+ console.error(`Failed to listInputMethodSubtype: ${JSON.stringify(err)}`);
}
```
@@ -1066,15 +2214,15 @@ listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSub
```js
try {
- inputMethodSetting.listCurrentInputMethodSubtype((err, data) => {
- if (err !== undefined) {
- console.error('Failed to listCurrentInputMethodSubtype: ' + JSON.stringify(err));
- return;
- }
- console.log('Succeeded in listing currentInputMethodSubtype.');
- });
+ inputMethodSetting.listCurrentInputMethodSubtype((err, data) => {
+ if (err) {
+ console.error(`Failed to listCurrentInputMethodSubtype: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in listing currentInputMethodSubtype.');
+ });
} catch(err) {
- console.error('Failed to listCurrentInputMethodSubtype: ' + JSON.stringify(err));
+ console.error(`Failed to listCurrentInputMethodSubtype: ${JSON.stringify(err)}`);
}
```
@@ -1105,13 +2253,13 @@ listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>>
```js
try {
- inputMethodSetting.listCurrentInputMethodSubtype().then((data) => {
- console.info('Succeeded in listing currentInputMethodSubtype.');
- }).catch((err) => {
- console.error('Failed to listCurrentInputMethodSubtype: ' + JSON.stringify(err));
- })
+ inputMethodSetting.listCurrentInputMethodSubtype().then((data) => {
+ console.log('Succeeded in listing currentInputMethodSubtype.');
+ }).catch((err) => {
+ console.error(`Failed to listCurrentInputMethodSubtype: ${JSON.stringify(err)}`);
+ })
} catch(err) {
- console.error('Failed to listCurrentInputMethodSubtype: ' + JSON.stringify(err));
+ console.error(`Failed to listCurrentInputMethodSubtype: ${JSON.stringify(err)}`);
}
```
@@ -1119,7 +2267,9 @@ try {
getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethodProperty>>): void
-获取已激活/未激活输入法列表。参数enable取true,返回已激活输入法列表,取false返回未激活输入法列表。已激活/未激活输入法的确切功能当前版本未支持。当前版本中,已激活输入法包括当前使用的输入法,未激活输入法包括当前输入法以外的其他已安装的输入法。使用callback异步回调。
+获取已激活/未激活输入法列表。使用callback异步回调。
+
+参数enable取true,返回已激活输入法列表;取false返回未激活输入法列表。已激活/未激活为预留概念,当前暂未支持。当前版本中,已激活输入法包括当前使用的输入法,未激活输入法包括当前输入法以外的其他已安装的输入法。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1143,15 +2293,15 @@ getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethod
```js
try {
- inputMethodSetting.getInputMethods(true, (err,data) => {
- if (err !== undefined) {
- console.error('Failed to getInputMethods: ' + JSON.stringify(err));
- return;
- }
- console.log('Succeeded in getting inputMethods.');
- });
+ inputMethodSetting.getInputMethods(true, (err, data) => {
+ if (err) {
+ console.error(`Failed to getInputMethods: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in getting inputMethods.');
+ });
} catch (err) {
- console.error('Failed to getInputMethods: ' + JSON.stringify(err));
+ console.error(`Failed to getInputMethods: ${JSON.stringify(err)}`);
}
```
@@ -1159,7 +2309,9 @@ try {
getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>
-获取已激活/未激活输入法列表。参数enable取true,返回已激活输入法列表,取false返回未激活输入法列表。已激活/未激活输入法的确切功能当前版本未支持。当前版本中,已激活输入法包括当前使用的输入法,未激活输入法包括当前输入法以外的其他已安装的输入法。使用promise异步回调。
+获取已激活/未激活输入法列表。使用promise异步回调。
+
+参数enable取true,返回已激活输入法列表;取false返回未激活输入法列表。已激活/未激活为预留概念,当前暂未支持。当前版本中,已激活输入法包括当前使用的输入法,未激活输入法包括当前输入法以外的其他已安装的输入法。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1188,13 +2340,13 @@ getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>
```js
try {
- inputMethodSetting.getInputMethods(true).then((data) => {
- console.info('Succeeded in getting inputMethods.');
- }).catch((err) => {
- console.error('Failed to getInputMethods: ' + JSON.stringify(err));
- })
+ inputMethodSetting.getInputMethods(true).then((data) => {
+ console.log('Succeeded in getting inputMethods.');
+ }).catch((err) => {
+ console.error(`Failed to getInputMethods: ${JSON.stringify(err)}`);
+ })
} catch(err) {
- console.error('Failed to getInputMethods: ' + JSON.stringify(err));
+ console.error(`Failed to getInputMethods: ${JSON.stringify(err)}`);
}
```
@@ -1224,15 +2376,15 @@ showOptionalInputMethods(callback: AsyncCallback<boolean>): void
```js
try {
- inputMethodSetting.showOptionalInputMethods((err, data) => {
- if (err !== undefined) {
- console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err));
- return;
- }
- console.info('Succeeded in showing optionalInputMethods.');
- });
+ inputMethodSetting.showOptionalInputMethods((err, data) => {
+ if (err) {
+ console.error(`Failed to showOptionalInputMethods: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in showing optionalInputMethods.');
+ });
} catch (err) {
- console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err));
+ console.error(`Failed to showOptionalInputMethods: ${JSON.stringify(err)}`);
}
```
@@ -1262,9 +2414,9 @@ showOptionalInputMethods(): Promise<boolean>
```js
inputMethodSetting.showOptionalInputMethods().then((data) => {
- console.info('Succeeded in showing optionalInputMethods.');
+ console.log('Succeeded in showing optionalInputMethods.');
}).catch((err) => {
- console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err));
+ console.error(`Failed to showOptionalInputMethods: ${JSON.stringify(err)}`);
})
```
@@ -1276,7 +2428,7 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>)
> **说明:**
>
-> 从API version 8开始支持,从API version 9开始废弃, 建议使用[getInputMethods](#getinputmethods9)替代。
+> 从API version 8开始支持,从API version 9开始废弃,建议使用[getInputMethods](#getinputmethods9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1289,12 +2441,12 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>)
**示例:**
```js
-inputMethodSetting.listInputMethod((err,data) => {
- if (err !== undefined) {
- console.error('Failed to listInputMethod: ' + JSON.stringify(err));
- return;
- }
- console.log('Succeeded in listing inputMethod.');
+inputMethodSetting.listInputMethod((err, data) => {
+ if (err) {
+ console.error(`Failed to listInputMethod: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in listing inputMethod.');
});
```
@@ -1306,7 +2458,7 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
> **说明:**
>
-> 从API version 8开始支持,从API version 9开始废弃, 建议使用[getInputMethods](#getinputmethods9-1)替代。
+> 从API version 8开始支持,从API version 9开始废弃,建议使用[getInputMethods](#getinputmethods9-1)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1320,9 +2472,9 @@ listInputMethod(): Promise<Array<InputMethodProperty>>
```js
inputMethodSetting.listInputMethod().then((data) => {
- console.info('Succeeded in listing inputMethod.');
+ console.log('Succeeded in listing inputMethod.');
}).catch((err) => {
- console.error('Failed to listInputMethod: ' + JSON.stringify(err));
+ console.error(`Failed to listInputMethod: ${JSON.stringify(err)}`);
})
```
@@ -1334,7 +2486,7 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void
> **说明:**
>
-> 从API version 8开始支持,从API version 9开始废弃, 建议使用[showOptionalInputMethods()](#showoptionalinputmethods9)替代。
+> 从API version 8开始支持,从API version 9开始废弃,建议使用[showOptionalInputMethods()](#showoptionalinputmethods9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1348,11 +2500,11 @@ displayOptionalInputMethod(callback: AsyncCallback<void>): void
```js
inputMethodSetting.displayOptionalInputMethod((err) => {
- if (err !== undefined) {
- console.error('Failed to displayOptionalInputMethod: ' + JSON.stringify(err));
- return;
- }
- console.info('Succeeded in displaying optionalInputMethod.');
+ if (err) {
+ console.error(`Failed to displayOptionalInputMethod: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in displaying optionalInputMethod.');
});
```
@@ -1364,7 +2516,7 @@ displayOptionalInputMethod(): Promise<void>
> **说明:**
>
-> 从API version 8开始支持,从API version 9开始废弃, 建议使用[showOptionalInputMethods()](#showoptionalinputmethods9-1)替代。
+> 从API version 8开始支持,从API version 9开始废弃,建议使用[showOptionalInputMethods()](#showoptionalinputmethods9-1)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1378,8 +2530,8 @@ displayOptionalInputMethod(): Promise<void>
```js
inputMethodSetting.displayOptionalInputMethod().then(() => {
- console.info('Succeeded in displaying optionalInputMethod.');
+ console.log('Succeeded in displaying optionalInputMethod.');
}).catch((err) => {
- console.error('Failed to displayOptionalInputMethod: ' + JSON.stringify(err));
+ console.error(`Failed to displayOptionalInputMethod: ${JSON.stringify(err)}`);
})
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
index a57312c378648d09c9928f1431ccd4d6fdc29324..fb2f36800068a663d2625e9bcffeb2ff627998f4 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
@@ -56,7 +56,9 @@ import inputMethodEngine from '@ohos.inputMethodEngine';
getInputMethodAbility(): InputMethodAbility
-为输入法应用获取输入法应用客户端实例[InputMethodAbility](#inputmethodability)。输入法应用获取该实例可订阅软键盘显示/隐藏请求事件、创建/销毁输入法应用面板等。
+为输入法应用获取输入法应用客户端实例[InputMethodAbility](#inputmethodability)。
+该接口仅限于输入法应用调用。
+输入法应用获取该实例可订阅软键盘显示/隐藏请求事件、创建/销毁输入法应用面板等。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -100,7 +102,7 @@ getInputMethodEngine(): InputMethodEngine
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[getInputMethodAbility()](#inputmethodenginegetinputmethodability9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[getInputMethodAbility()](#inputmethodenginegetinputmethodability9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -124,7 +126,7 @@ createKeyboardDelegate(): KeyboardDelegate
> **说明:**
>
->从API version 8开始支持,API version 9开始废弃, 建议使用[getKeyboardDelegate()](#inputmethodenginegetkeyboarddelegate9)替代。
+>从API version 8开始支持,API version 9开始废弃,建议使用[getKeyboardDelegate()](#inputmethodenginegetkeyboarddelegate9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -163,8 +165,8 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, textInputCli
```js
inputMethodEngine.getInputMethodEngine().on('inputStart', (kbController, textClient) => {
- let keyboardController = kbController;
- let textInputClient = textClient;
+ let keyboardController = kbController;
+ let textInputClient = textClient;
});
```
@@ -187,7 +189,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC
```js
inputMethodEngine.getInputMethodEngine().off('inputStart', (kbController, textInputClient) => {
- console.log('delete inputStart notification.');
+ console.log('delete inputStart notification.');
});
```
@@ -210,10 +212,10 @@ on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
```js
inputMethodEngine.getInputMethodEngine().on('keyboardShow', () => {
- console.log('inputMethodEngine keyboardShow.');
+ console.log('inputMethodEngine keyboardShow.');
});
inputMethodEngine.getInputMethodEngine().on('keyboardHide', () => {
- console.log('inputMethodEngine keyboardHide.');
+ console.log('inputMethodEngine keyboardHide.');
});
```
@@ -262,8 +264,8 @@ on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient:
```js
inputMethodEngine.getInputMethodAbility().on('inputStart', (kbController, client) => {
- let keyboardController = kbController;
- let inputClient = client;
+ let keyboardController = kbController;
+ let inputClient = client;
});
```
@@ -307,7 +309,7 @@ on(type: 'inputStop', callback: () => void): void
```js
inputMethodEngine.getInputMethodAbility().on('inputStop', () => {
- console.log('inputMethodAbility inputStop');
+ console.log('inputMethodAbility inputStop');
});
```
@@ -330,7 +332,7 @@ off(type: 'inputStop', callback: () => void): void
```js
inputMethodEngine.getInputMethodAbility().off('inputStop', () => {
- console.log('inputMethodAbility delete inputStop notification.');
+ console.log('inputMethodAbility delete inputStop notification.');
});
```
@@ -353,7 +355,7 @@ on(type: 'setCallingWindow', callback: (wid: number) => void): void
```js
inputMethodEngine.getInputMethodAbility().on('setCallingWindow', (wid) => {
- console.log('inputMethodAbility setCallingWindow');
+ console.log('inputMethodAbility setCallingWindow');
});
```
@@ -376,7 +378,7 @@ off(type: 'setCallingWindow', callback: (wid:number) => void): void
```js
inputMethodEngine.getInputMethodAbility().off('setCallingWindow', () => {
- console.log('inputMethodAbility delete setCallingWindow notification.');
+ console.log('inputMethodAbility delete setCallingWindow notification.');
});
```
@@ -399,10 +401,10 @@ on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
```js
inputMethodEngine.getInputMethodAbility().on('keyboardShow', () => {
- console.log('InputMethodAbility keyboardShow.');
+ console.log('InputMethodAbility keyboardShow.');
});
inputMethodEngine.getInputMethodAbility().on('keyboardHide', () => {
- console.log('InputMethodAbility keyboardHide.');
+ console.log('InputMethodAbility keyboardHide.');
});
```
@@ -425,10 +427,10 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
```js
inputMethodEngine.getInputMethodAbility().off('keyboardShow', () => {
- console.log('InputMethodAbility delete keyboardShow notification.');
+ console.log('InputMethodAbility delete keyboardShow notification.');
});
inputMethodEngine.getInputMethodAbility().off('keyboardHide', () => {
- console.log('InputMethodAbility delete keyboardHide notification.');
+ console.log('InputMethodAbility delete keyboardHide notification.');
});
```
@@ -442,16 +444,16 @@ on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => voi
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 设置监听类型。 - type为'setSubtype',表示订阅输入法子类型的设置事件。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --- | ---- | --- |
+| type | string | 是 | 设置监听类型。 - type为'setSubtype',表示订阅输入法子类型的设置事件。 |
| callback | (inputMethodSubtype: [InputMethodSubtype](js-apis-inputmethod-subtype.md)) => void | 是 | 回调函数,返回设置的输入法子类型。 |
**示例:**
```js
inputMethodEngine.getInputMethodAbility().on('setSubtype', (inputMethodSubtype) => {
- console.log('InputMethodAbility setSubtype.');
+ console.log('InputMethodAbility setSubtype.');
});
```
@@ -465,16 +467,16 @@ off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => v
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 设置监听类型。 - type为'setSubtype',表示取消订阅输入法子类型的设置事件。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| ------- | ----- | ---- | ---- |
+| type | string | 是 | 设置监听类型。 - type为'setSubtype',表示取消订阅输入法子类型的设置事件。 |
| callback | (inputMethodSubtype: [InputMethodSubtype](js-apis-inputmethod-subtype.md)) => void | 否 | 回调函数,返回设置的输入法子类型。 |
**示例:**
```js
inputMethodEngine.getInputMethodAbility().off('setSubtype', () => {
- console.log('InputMethodAbility delete setSubtype notification.');
+ console.log('InputMethodAbility delete setSubtype notification.');
});
```
@@ -482,7 +484,9 @@ inputMethodEngine.getInputMethodAbility().off('setSubtype', () => {
createPanel(ctx: BaseContext, info: PanelInfo, callback: AsyncCallback\): void
-创建输入法应用面板。仅支持输入法应用或者具有system_core权限的系统应用调用。单个输入法应用仅仅允许创建一个SOFT_KEYBOARD及一个STATUS_BAR类型的面板。使用callback异步回调。
+创建输入法应用面板。使用callback异步回调。
+
+仅支持输入法应用调用。单个输入法应用仅仅允许创建一个SOFT_KEYBOARD及一个STATUS_BAR类型的面板。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -504,19 +508,19 @@ createPanel(ctx: BaseContext, info: PanelInfo, callback: AsyncCallback\):
```js
let panelInfo: inputMethodEngine.PanelInfo = {
- panelType: SOFT_KEYBOARD,
- panelFlag: FLG_FIXED
+ panelType: inputMethodEngine.PanelType.SOFT_KEYBOARD,
+ panelFlag: inputMethodEngine.PanelFlag.FLG_FIXED
}
try {
inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => {
- if (err !== undefined) {
- console.log('Failed to create panel, err: ' + JSON.stringify(err));
+ if (err) {
+ console.error(`Failed to createPanel: ${JSON.stringify(err)}`);
return;
}
console.log('Succeed in creating panel.');
})
} catch(err) {
- console.log('Failed to create panel, err: ' + JSON.stringify(err));
+ console.error(`Failed to createPanel: ${JSON.stringify(err)}`);
}
```
@@ -524,7 +528,9 @@ try {
createPanel(ctx: BaseContext, info: PanelInfo): Promise\
-创建输入法应用面板。仅支持输入法应用或者具有system_core权限的系统应用调用。单个输入法应用仅仅允许创建一个SOFT_KEYBOARD及一个STATUS_BAR类型的面板。使用promise异步回调。
+创建输入法应用面板。使用promise异步回调。
+
+仅支持输入法应用调用。单个输入法应用仅仅允许创建一个SOFT_KEYBOARD及一个STATUS_BAR类型的面板。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -550,13 +556,13 @@ createPanel(ctx: BaseContext, info: PanelInfo): Promise\
```js
let panelInfo: inputMethodEngine.PanelInfo = {
- panelType: SOFT_KEYBOARD,
- panelFlag: FLG_FIXED
+ panelType: inputMethodEngine.PanelType.SOFT_KEYBOARD,
+ panelFlag: inputMethodEngine.PanelFlag.FLG_FIXED
}
inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo).then((panel) => {
console.log('Succeed in creating panel.');
}).catch((err) => {
- console.log('Failed to create panel, err: ' + JSON.stringify(err));
+ console.error(`Failed to create panel: ${JSON.stringify(err)}`);
})
```
@@ -579,32 +585,32 @@ destroyPanel(panel: Panel, callback: AsyncCallback\): void;
```js
let panelInfo: inputMethodEngine.PanelInfo = {
- panelType: SOFT_KEYBOARD,
- panelFlag: FLG_FIXED
+ panelType: inputMethodEngine.PanelType.SOFT_KEYBOARD,
+ panelFlag: inputMethodEngine.PanelFlag.FLG_FIXED
}
try {
inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => {
- if (err !== undefined) {
- console.log('Failed to create panel, err: ' + JSON.stringify(err));
+ if (err) {
+ console.error(`Failed to create panel: ${JSON.stringify(err)}`);
return;
}
globalThis.inputMethodPanel = panel;
console.log('Succeed in creating panel.');
})
} catch(err) {
- console.log('Failed to create panel, err: ' + JSON.stringify(err));
+ console.error(`Failed to create panel: ${JSON.stringify(err)}`);
}
try {
inputMethodEngine.getInputMethodAbility().destroyPanel(globalThis.inputMethodPanel, (err) => {
if(err !== undefined) {
- console.log('Failed to destroy panel, err: ' + JSON.stringify(err));
+ console.error(`Failed to destroy panel: ${JSON.stringify(err)}`);
return;
}
console.log('Succeed in destroying panel.');
})
} catch(err) {
- console.log('Failed to destroy panel, err: ' + JSON.stringify(err));
+ console.error(`Failed to destroy panel: ${JSON.stringify(err)}`);
}
```
@@ -631,30 +637,30 @@ destroyPanel(panel: Panel): Promise\;
```js
let panelInfo: inputMethodEngine.PanelInfo = {
- panelType: SOFT_KEYBOARD,
- panelFlag: FLG_FIXED
+ panelType: inputMethodEngine.PanelType.SOFT_KEYBOARD,
+ panelFlag: inputMethodEngine.PanelFlag.FLG_FIXED
}
try {
inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => {
- if (err !== undefined) {
- console.log('Failed to create panel, err: ' + JSON.stringify(err));
+ if (err) {
+ console.error(`Failed to create panel: ${JSON.stringify(err)}`);
return;
}
globalThis.inputMethodPanel = panel;
console.log('Succeed in creating panel.');
})
} catch(err) {
- console.log('Failed to create panel, err: ' + JSON.stringify(err));
+ console.error(`Failed to create panel: ${JSON.stringify(err)}`);
}
try {
inputMethodEngine.getInputMethodAbility().destroyPanel(globalThis.inputMethodPanel).then(() => {
console.log('Succeed in destroying panel.');
}).catch((err) => {
- console.log('Failed to destroy panel, err: ' + JSON.stringify(err));
+ console.error(`Failed to destroy panel: ${JSON.stringify(err)}`);
});
} catch (err) {
- console.log('Failed to destroy panel, err: ' + JSON.stringify(err));
+ console.error(`Failed to destroy panel: ${JSON.stringify(err)}`);
}
```
@@ -681,14 +687,14 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
```js
inputMethodEngine.getKeyboardDelegate().on('keyUp', (keyEvent) => {
- console.info('inputMethodEngine keyCode.(keyUp):' + JSON.stringify(keyEvent.keyCode));
- console.info('inputMethodEngine keyAction.(keyUp):' + JSON.stringify(keyEvent.keyAction));
- return true;
+ console.log('inputMethodEngine keyCode.(keyUp):' + JSON.stringify(keyEvent.keyCode));
+ console.log('inputMethodEngine keyAction.(keyUp):' + JSON.stringify(keyEvent.keyAction));
+ return true;
});
inputMethodEngine.getKeyboardDelegate().on('keyDown', (keyEvent) => {
- console.info('inputMethodEngine keyCode.(keyDown):' + JSON.stringify(keyEvent.keyCode));
- console.info('inputMethodEngine keyAction.(keyDown):' + JSON.stringify(keyEvent.keyAction));
- return true;
+ console.log('inputMethodEngine keyCode.(keyDown):' + JSON.stringify(keyEvent.keyCode));
+ console.log('inputMethodEngine keyAction.(keyDown):' + JSON.stringify(keyEvent.keyAction));
+ return true;
});
```
@@ -702,21 +708,21 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 设置监听类型。 - type为'keyDown',表示取消订阅硬键盘按下事件。 - type为'keyUp',表示取消订阅硬键盘抬起事件。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------- | ---- | ----- |
+| type | string | 是 | 设置监听类型。 - type为'keyDown',表示取消订阅硬键盘按下事件。 - type为'keyUp',表示取消订阅硬键盘抬起事件。 |
| callback | (event: [KeyEvent](#keyevent)) => boolean | 否 | 回调函数,返回按键信息。 |
**示例:**
```js
inputMethodEngine.getKeyboardDelegate().off('keyUp', (keyEvent) => {
- console.log('delete keyUp notification.');
- return true;
+ console.log('delete keyUp notification.');
+ return true;
});
inputMethodEngine.getKeyboardDelegate().off('keyDown', (keyEvent) => {
- console.log('delete keyDown notification.');
- return true;
+ console.log('delete keyDown notification.');
+ return true;
});
```
@@ -730,18 +736,18 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) =
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 光标变化事件。 - type为’cursorContextChange‘时,表示订阅光标变化事件。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---- | ---- | ----- |
+| type | string | 是 | 光标变化事件。 - type为’cursorContextChange‘时,表示订阅光标变化事件。 |
| callback | (x: number, y: number, height: number) => void | 是 | 回调函数,返回光标信息。 - x为光标上端的的x坐标值。 - y为光标上端的y坐标值。 - height为光标的高度值。 |
**示例:**
```js
inputMethodEngine.getKeyboardDelegate().on('cursorContextChange', (x, y, height) => {
- console.log('inputMethodEngine cursorContextChange x:' + x);
- console.log('inputMethodEngine cursorContextChange y:' + y);
- console.log('inputMethodEngine cursorContextChange height:' + height);
+ console.log('inputMethodEngine cursorContextChange x:' + x);
+ console.log('inputMethodEngine cursorContextChange y:' + y);
+ console.log('inputMethodEngine cursorContextChange height:' + height);
});
```
@@ -755,9 +761,9 @@ off(type: 'cursorContextChange', callback?: (x: number, y: number, height: numbe
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 光标变化事件。 - type为’cursorContextChange‘时,表示光标变化。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---- | ---- | ------ |
+| type | string | 是 | 光标变化事件。 - type为’cursorContextChange‘时,表示光标变化。 |
| callback | (x: number, y:number, height:number) => void | 否 | 回调函数,返回光标信息。 - x为光标上端的的x坐标值。 - y为光标上端的y坐标值。 - height为光标的高度值。 |
@@ -765,7 +771,7 @@ off(type: 'cursorContextChange', callback?: (x: number, y: number, height: numbe
```js
inputMethodEngine.getKeyboardDelegate().off('cursorContextChange', (x, y, height) => {
- console.log('delete cursorContextChange notification.');
+ console.log('delete cursorContextChange notification.');
});
```
### on('selectionChange')
@@ -778,19 +784,19 @@ on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegi
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 文本选择变化事件。 - type为’selectionChange‘时,表示选择文本变化。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----- | ---- | ---- |
+| type | string | 是 | 文本选择变化事件。 - type为’selectionChange‘时,表示选择文本变化。 |
| callback | (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void | 是 | 回调函数,返回文本选择信息。 - oldBegin为变化之前被选中文本的起始下标。 - oldEnd为变化之前被选中文本的终止下标。 - newBegin为变化之后被选中文本的起始下标。 - newEnd为变化之后被选中文本的终止下标。 |
**示例:**
```js
inputMethodEngine.getKeyboardDelegate().on('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => {
- console.log('inputMethodEngine beforeEach selectionChange oldBegin:' + oldBegin);
- console.log('inputMethodEngine beforeEach selectionChange oldEnd:' + oldEnd);
- console.log('inputMethodEngine beforeEach selectionChange newBegin:' + newBegin);
- console.log('inputMethodEngine beforeEach selectionChange newEnd:' + newEnd);
+ console.log('inputMethodEngine beforeEach selectionChange oldBegin:' + oldBegin);
+ console.log('inputMethodEngine beforeEach selectionChange oldEnd:' + oldEnd);
+ console.log('inputMethodEngine beforeEach selectionChange newBegin:' + newBegin);
+ console.log('inputMethodEngine beforeEach selectionChange newEnd:' + newEnd);
});
```
@@ -804,9 +810,9 @@ off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBe
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 文本选择变化事件。 - type为’selectionChange‘时,表示选择文本变化。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------- | ---- | ------- |
+| type | string | 是 | 文本选择变化事件。 - type为’selectionChange‘时,表示选择文本变化。 |
| callback | (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void | 否 | 回调函数,返回文本选择信息。 - oldBegin为变化之前被选中文本的起始下标。 - oldEnd为变化之前被选中文本的终止下标。 - newBegin为变化之后被选中文本的起始下标。 - newEnd为变化之后被选中文本的终止下标。 |
**示例:**
@@ -831,13 +837,13 @@ on(type: 'textChange', callback: (text: string) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 文本变化事件。 - type为’textChange‘时,表示订阅文本变化事件。 |
-| callback | (text: string) => void | 是 | 回调函数,返回订阅的文本内容。 |
+| callback | (text: string) => void | 是 | 回调函数,返回订阅的文本内容。|
**示例:**
```js
inputMethodEngine.getKeyboardDelegate().on('textChange', (text) => {
- console.log('inputMethodEngine textChange. text:' + text);
+ console.log('inputMethodEngine textChange. text:' + text);
});
```
@@ -860,7 +866,7 @@ off(type: 'textChange', callback?: (text: string) => void): void
```js
inputMethodEngine.getKeyboardDelegate().off('textChange', (text) => {
- console.log('delete textChange notification. text:' + text);
+ console.log('delete textChange notification. text:' + text);
});
```
@@ -889,13 +895,13 @@ setUiContent(path: string, callback: AsyncCallback\): void
try {
panel.setUiContent('pages/page2/page2', (err) => {
if (err) {
- console.error('Failed to set the content. err:' + JSON.stringify(err));
+ console.error(`Failed to setUiContent: ${JSON.stringify(err)}`);
return;
}
- console.info('Succeeded in setting the content.');
+ console.log('Succeeded in setting the content.');
});
-} catch (exception) {
- console.error('Failed to set the content. err:' + JSON.stringify(exception));
+} catch (err) {
+ console.error(`Failed to setUiContent: ${JSON.stringify(err)}`);
}
```
@@ -925,12 +931,12 @@ setUiContent(path: string): Promise\
try {
let promise = panel.setUiContent('pages/page2/page2');
promise.then(() => {
- console.info('Succeeded in setting the content.');
+ console.log('Succeeded in setting the content.');
}).catch((err) =>{
- console.error('Failed to set the content. err: ' + JSON.stringify(err));
+ console.error(`Failed to setUiContent: ${JSON.stringify(err)}`);
});
-} catch (exception) {
- console.error('Failed to set the content. err: ' + JSON.stringify(exception));
+} catch (err) {
+ console.error(`Failed to setUiContent: ${JSON.stringify(err)}`);
}
```
@@ -958,13 +964,13 @@ storage.setOrCreate('storageSimpleProp',121);
try {
panel.setUiContent('pages/page2/page2', storage, (err) => {
if (err) {
- console.error('Failed to set the content. err:' + JSON.stringify(err));
+ console.error(`Failed to setUiContent: ${JSON.stringify(err)}`);
return;
}
- console.info('Succeeded in setting the content.');
+ console.log('Succeeded in setting the content.');
});
-} catch (exception) {
- console.error('Failed to set the content. err:' + JSON.stringify(exception));
+} catch (err) {
+ console.error(`Failed to setUiContent: ${JSON.stringify(err)}`);
}
```
@@ -997,12 +1003,12 @@ storage.setOrCreate('storageSimpleProp',121);
try {
let promise = panel.setUiContent('pages/page2/page2');
promise.then(() => {
- console.info('Succeeded in setting the content.');
+ console.log('Succeeded in setting the content.');
}).catch((err) =>{
- console.error('Failed to set the content. err: ' + JSON.stringify(err));
+ console.error(`Failed to setUiContent: ${JSON.stringify(err)}`);
});
-} catch (exception) {
- console.error('Failed to set the content. err: ' + JSON.stringify(exception));
+} catch (err) {
+ console.error(`Failed to setUiContent: ${JSON.stringify(err)}`);
}
```
@@ -1011,6 +1017,7 @@ try {
resize(width: number, height: number, callback: AsyncCallback\): void
改变当前面板大小,使用callback异步回调。
+
面板存在大小限制,面板宽度不超出屏幕宽度,面板高度不高于屏幕高度的二分之一。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1029,13 +1036,13 @@ resize(width: number, height: number, callback: AsyncCallback\): void
try {
panel.resize(500, 1000, (err) => {
if (err) {
- console.error('Failed to change the panel size. Cause:' + JSON.stringify(err));
+ console.error(`Failed to resize panel: ${JSON.stringify(err)}`);
return;
}
- console.info('Succeeded in changing the panel size.');
+ console.log('Succeeded in changing the panel size.');
});
-} catch (exception) {
- console.error('Failed to change the panel size. Cause:' + JSON.stringify(exception));
+} catch (err) {
+ console.error(`Failed to resize panel: ${JSON.stringify(err)}`);
}
```
@@ -1044,6 +1051,7 @@ try {
resize(width: number, height: number): Promise\;
改变当前面板大小,使用Promise异步回调。
+
面板存在大小限制,面板宽度不超出屏幕宽度,面板高度不高于屏幕高度的二分之一。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1067,12 +1075,12 @@ resize(width: number, height: number): Promise\;
try {
let promise = panel.resize(500, 1000);
promise.then(() => {
- console.info('Succeeded in changing the panel size.');
+ console.log('Succeeded in changing the panel size.');
}).catch((err) =>{
- console.error('Failed to change the panel size. err: ' + JSON.stringify(err));
+ console.error(`Failed to resize panel: ${JSON.stringify(err)}`);
});
-} catch (exception) {
- console.error('Failed to change the panel size. err: ' + JSON.stringify(exception));
+} catch (err) {
+ console.error(`Failed to resize panel: ${JSON.stringify(err)}`);
}
```
@@ -1081,6 +1089,7 @@ try {
moveTo(x: number, y: number, callback: AsyncCallback\): void
移动面板位置,使用callback异步回调。
+
对FLG_FIXED状态的panel不产生实际移动效果。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1099,13 +1108,13 @@ moveTo(x: number, y: number, callback: AsyncCallback\): void
try {
panel.moveTo(300, 300, (err) =>{
if (err) {
- console.error('Failed to move the panel. err:' + JSON.stringify(err));
+ console.error(`Failed to move panel: ${JSON.stringify(err)}`);
return;
}
- console.info('Succeeded in moving the panel.');
+ console.log('Succeeded in moving the panel.');
});
-} catch (exception) {
- console.error('Failed to move the panel. err:' + JSON.stringify(exception));
+} catch (err) {
+ console.error(`Failed to move panel: ${JSON.stringify(err)}`);
}
```
@@ -1114,6 +1123,7 @@ try {
moveTo(x: number, y: number): Promise\
移动面板位置,使用callback异步回调。
+
对FLG_FIXED状态的panel不产生实际移动效果。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1137,12 +1147,12 @@ moveTo(x: number, y: number): Promise\
try {
let promise = windowClass.moveTo(300, 300);
promise.then(() => {
- console.info('Succeeded in moving the panel.');
+ console.log('Succeeded in moving the panel.');
}).catch((err) =>{
- console.error('Failed to move the panel. Cause: ' + JSON.stringify(err));
+ console.error(`Failed to move panel: ${JSON.stringify(err)}`);
});
-} catch (exception) {
- console.error('Failed to move the panel. Cause:' + JSON.stringify(exception));
+} catch (err) {
+ console.error(`Failed to move panel: ${JSON.stringify(err)}`);
}
```
@@ -1165,10 +1175,10 @@ show(callback: AsyncCallback\): void
```js
panel.show((err) => {
if (err) {
- console.error('Failed to show the panel. Cause: ' + JSON.stringify(err));
+ console.error(`Failed to show panel: ${JSON.stringify(err)}`);
return;
}
- console.info('Succeeded in showing the panel.');
+ console.log('Succeeded in showing the panel.');
});
```
@@ -1191,9 +1201,9 @@ show(): Promise\
```js
let promise = panel.show();
promise.then(() => {
- console.info('Succeeded in showing the panel.');
+ console.log('Succeeded in showing the panel.');
}).catch((err) =>{
- console.error('Failed to show the panel. err: ' + JSON.stringify(err));
+ console.error(`Failed to show panel: ${JSON.stringify(err)}`);
});
```
@@ -1216,10 +1226,10 @@ hide(callback: AsyncCallback\): void
```js
panel.hide((err) => {
if (err) {
- console.error('Failed to hide the panel. Cause: ' + JSON.stringify(err));
+ console.error(`Failed to hide panel: ${JSON.stringify(err)}`);
return;
}
- console.info('Succeeded in hiding the panel.');
+ console.log('Succeeded in hiding the panel.');
});
```
@@ -1242,9 +1252,9 @@ hide(): Promise\
```js
let promise = panel.hide();
promise.then(() => {
- console.info('Succeeded in hiding the panel.');
+ console.log('Succeeded in hiding the panel.');
}).catch((err) =>{
- console.error('Failed to hide the panel. err: ' + JSON.stringify(err));
+ console.error(`Failed to hide panel: ${JSON.stringify(err)}`);
});
```
@@ -1252,7 +1262,7 @@ promise.then(() => {
on(type: 'show' | 'hide', callback: () => void): void
-监听当前面板状态,可监听面板类型为show或者hide, 使用callback异步回调。
+监听当前面板状态,使用callback异步回调。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1267,7 +1277,7 @@ on(type: 'show' | 'hide', callback: () => void): void
```js
panel.on('show', () => {
- console.info('Panel is showing.');
+ console.log('Panel is showing.');
});
```
@@ -1275,7 +1285,7 @@ panel.on('show', () => {
off(type: 'show' | 'hide', callback?: () => void): void
-取消监听当前面板状态,可取消监听的面板类型为show或者hide,使用callback异步回调。
+取消监听当前面板状态,使用callback异步回调。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1283,7 +1293,7 @@ off(type: 'show' | 'hide', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | -------- |
-| type | 'show'/'hide' | 是 | 要取消监听的当前面板状态类型,show表示显示状态,hide表示隐藏状态 |
+| type | 'show'\|'hide' | 是 | 要取消监听的当前面板状态类型,show表示显示状态,hide表示隐藏状态 |
| callback | () => void | 否 | 回调函数。 |
**示例:**
@@ -1343,11 +1353,11 @@ hide(callback: AsyncCallback<void>): void
```js
keyboardController.hide((err) => {
- if (err !== undefined) {
- console.error('Failed to hide keyboard: ' + JSON.stringify(err));
- return;
- }
- console.log('Succeeded in hiding keyboard.');
+ if (err) {
+ console.error(`Failed to hide: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in hiding keyboard.');
});
```
@@ -1377,9 +1387,9 @@ hide(): Promise<void>
```js
keyboardController.hide().then(() => {
- console.info('Succeeded in hiding keyboard.');
+ console.log('Succeeded in hiding keyboard.');
}).catch((err) => {
- console.info('Failed to hide keyboard: ' + JSON.stringify(err));
+ console.log(`Failed to hide: ${JSON.stringify(err)}`);
});
```
@@ -1391,7 +1401,7 @@ hideKeyboard(callback: AsyncCallback<void>): void
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[hide](#hide9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[hide](#hide9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1405,11 +1415,11 @@ hideKeyboard(callback: AsyncCallback<void>): void
```js
keyboardController.hideKeyboard((err) => {
- if (err !== undefined) {
- console.error('Failed to hide Keyboard: ' + JSON.stringify(err));
- return;
- }
- console.log('Succeeded in hiding keyboard.');
+ if (err) {
+ console.error(`Failed to hideKeyboard: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in hiding keyboard.');
});
```
@@ -1421,7 +1431,7 @@ hideKeyboard(): Promise<void>
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[hide](#hide9-1)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[hide](#hide9-1)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -1435,12 +1445,59 @@ hideKeyboard(): Promise<void>
```js
keyboardController.hideKeyboard().then(() => {
- console.info('Succeeded in hiding keyboard.');
+ console.log('Succeeded in hiding keyboard.');
}).catch((err) => {
- console.info('Failed to hide Keyboard: ' + JSON.stringify(err));
+ console.log(`Failed to hideKeyboard: ${JSON.stringify(err)}`);
});
```
+## ExtendAction10+
+
+对编辑框中文本的扩展编辑操作类型。
+
+**系统能力**: SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 值 |说明 |
+| -------- | -------- |-------- |
+| SELECT_ALL | 0 |全选。 |
+| CUT | 3 |剪切。 |
+| COPY | 4 |复制。 |
+| PASTE | 5 |粘贴。 |
+
+## Direction10+
+
+输入法光标移动方向。
+
+**系统能力**: SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 值 |说明 |
+| -------- | -------- |-------- |
+| CURSOR_UP | 1 |向上。 |
+| CURSOR_DOWN | 2 |向下。 |
+| CURSOR_LEFT | 3 |向左。 |
+| CURSOR_RIGHT | 4 |向右。 |
+
+## Range10+
+
+描述选中文本的范围。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| start | number | 是 | 是 | 选中文本的首字符在编辑框的索引值。|
+| end | number | 是 | 是 | 选中文本的末字符在编辑框的索引值。|
+
+## Movement10+
+
+描述进行选中文本动作时光标移动的方向。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| direction | [Direction](#direction10) | 是 | 是 | 进行选中文本动作时光标移动的方向。|
+
## InputClient9+
下列API示例中都需使用[on('inputStart')](#oninputstart9)回调获取到InputClient实例,再通过此实例调用对应方法。
@@ -1457,7 +1514,7 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
-| action | number | 是 | 功能键键值。 当值为0时,表示无效按键; 当值为1时,表示确认键(即回车键)。 |
+| action | number | 是 | 功能键键值。 - 当值为0时,表示无效按键; - 当值为1时,表示确认键(即回车键)。 |
| callback | AsyncCallback<boolean> | 是 | 回调函数。当功能键发送成功,err为undefined,data为true;否则为错误对象。 |
**错误码:**
@@ -1473,19 +1530,19 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void
```js
let action = 1;
try {
- inputClient.sendKeyFunction(action, (err, result) => {
- if (err !== undefined) {
- console.error('Failed to sendKeyFunction: ' + JSON.stringify(err));
- return;
- }
- if (result) {
- console.info('Succeeded in sending key function. ');
- } else {
- console.error('Failed to sendKeyFunction. ');
- }
- });
+ inputClient.sendKeyFunction(action, (err, result) => {
+ if (err) {
+ console.error(`Failed to sendKeyFunction: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in sending key function.');
+ } else {
+ console.error('Failed to sendKeyFunction.');
+ }
+ });
} catch (err) {
- console.error('sendKeyFunction err: ' + JSON.stringify(err));
+ console.error(`Failed to sendKeyFunction: ${JSON.stringify(err)}`);
}
```
@@ -1522,17 +1579,17 @@ sendKeyFunction(action: number): Promise<boolean>
```js
let action = 1;
try {
- inputClient.sendKeyFunction(action).then((result) => {
- if (result) {
- console.info('Succeeded in sending key function. ');
- } else {
- console.error('Failed to sendKeyFunction. ');
- }
- }).catch((err) => {
- console.error('Failed to sendKeyFunction:' + JSON.stringify(err));
- });
+ inputClient.sendKeyFunction(action).then((result) => {
+ if (result) {
+ console.log('Succeeded in sending key function.');
+ } else {
+ console.error('Failed to sendKeyFunction.');
+ }
+ }).catch((err) => {
+ console.error(`Failed to sendKeyFunction: ${JSON.stringify(err)}`);
+ });
} catch (err) {
- console.error('Failed to sendKeyFunction: ' + JSON.stringify(err));
+ console.error(`Failed to sendKeyFunction: ${JSON.stringify(err)}`);
}
```
@@ -1565,15 +1622,15 @@ getForward(length:number, callback: AsyncCallback<string>): void
```js
let length = 1;
try {
- inputClient.getForward(length, (err, text) => {
- if (err !== undefined) {
- console.error('Failed to getForward: ' + JSON.stringify(err));
- return;
- }
- console.log('Succeeded in getting forward, text: ' + text);
- });
+ inputClient.getForward(length, (err, text) => {
+ if (err) {
+ console.error(`Failed to getForward: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in getting forward, text: ' + text);
+ });
} catch (err) {
- console.error('Failed to getForward: ' + JSON.stringify(err));
+ console.error(`Failed to getForward: ${JSON.stringify(err)}`);
}
```
@@ -1611,13 +1668,13 @@ getForward(length:number): Promise<string>
```js
let length = 1;
try {
- inputClient.getForward(length).then((text) => {
- console.info('Succeeded in getting forward, text: ' + text);
- }).catch((err) => {
- console.error('Failed to getForward: ' + JSON.stringify(err));
- });
+ inputClient.getForward(length).then((text) => {
+ console.log('Succeeded in getting forward, text: ' + text);
+ }).catch((err) => {
+ console.error(`Failed to getForward: ${JSON.stringify(err)}`);
+ });
} catch (err) {
- console.error('Failed to getForward: ' + JSON.stringify(err));
+ console.error(`Failed to getForward: ${JSON.stringify(err)}`);
}
```
@@ -1650,15 +1707,15 @@ getBackward(length:number, callback: AsyncCallback<string>): void
```js
let length = 1;
try {
- inputClient.getBackward(length, (err, text) => {
- if (err !== undefined) {
- console.error('Failed to getForward: ' + JSON.stringify(err));
- return;
- }
- console.log('Succeeded in getting backward, text: ' + text);
- });
+ inputClient.getBackward(length, (err, text) => {
+ if (err) {
+ console.error(`Failed to getBackward: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in getting backward, text: ' + text);
+ });
} catch (err) {
- console.error('Failed to getForward: ' + JSON.stringify(err));
+ console.error(`Failed to getBackward: ${JSON.stringify(err)}`);
}
```
@@ -1696,13 +1753,13 @@ getBackward(length:number): Promise<string>
```js
let length = 1;
try {
- inputClient.getBackward(length).then((text) => {
- console.info('Succeeded in getting backward, text: ' + text);
- }).catch((err) => {
- console.error('Failed to getForward: ' + JSON.stringify(err));
- });
+ inputClient.getBackward(length).then((text) => {
+ console.log('Succeeded in getting backward, text: ' + text);
+ }).catch((err) => {
+ console.error(`Failed to getBackward: ${JSON.stringify(err)}`);
+ });
} catch (err) {
- console.error('Failed to getForward: ' + JSON.stringify(err));
+ console.error(`Failed to getBackward: ${JSON.stringify(err)}`);
}
```
@@ -1735,19 +1792,19 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
```js
let length = 1;
try {
- inputClient.deleteForward(length, (err, result) => {
- if (err !== undefined) {
- console.error('Failed to delete forward: ' + JSON.stringify(err));
- return;
- }
- if (result) {
- console.info('Succeeded in deleting forward. ');
- } else {
- console.error('Failed to delete forward: ' + JSON.stringify(err));
- }
- });
+ inputClient.deleteForward(length, (err, result) => {
+ if (err) {
+ console.error(`Failed to deleteForward: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in deleting forward.');
+ } else {
+ console.error(`Failed to deleteForward: ${JSON.stringify(err)}`);
+ }
+ });
} catch (err) {
- console.error('Failed to delete forward: ' + JSON.stringify(err));
+ console.error(`Failed to deleteForward: ${JSON.stringify(err)}`);
}
```
@@ -1785,17 +1842,17 @@ deleteForward(length:number): Promise<boolean>
```js
let length = 1;
try {
- inputClient.deleteForward(length).then((result) => {
- if (result) {
- console.info('Succeeded in deleting forward. ');
- } else {
- console.error('Failed to delete Forward. ');
- }
- }).catch((err) => {
- console.error('Failed to delete Forward: ' + JSON.stringify(err));
- });
+ inputClient.deleteForward(length).then((result) => {
+ if (result) {
+ console.log('Succeeded in deleting forward.');
+ } else {
+ console.error('Failed to delete Forward.');
+ }
+ }).catch((err) => {
+ console.error(`Failed to deleteForward: ${JSON.stringify(err)}`);
+ });
} catch (err) {
- console.error('Failed to delete Forward: ' + JSON.stringify(err));
+ console.error(`Failed to deleteForward: ${JSON.stringify(err)}`);
}
```
@@ -1828,19 +1885,19 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
```js
let length = 1;
try {
- inputClient.deleteBackward(length, (err, result) => {
- if (err !== undefined) {
- console.error('Failed to delete Backward: ' + JSON.stringify(err));
- return;
- }
- if (result) {
- console.info('Succeeded in deleting backward. ');
- } else {
- console.error('Failed to delete Backward: ' + JSON.stringify(err));
- }
- });
+ inputClient.deleteBackward(length, (err, result) => {
+ if (err) {
+ console.error(`Failed to deleteBackward: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in deleting backward.');
+ } else {
+ console.error(`Failed to deleteBackward: ${JSON.stringify(err)}`);
+ }
+ });
} catch (err) {
- console.error('deleteBackward err: ' + JSON.stringify(err));
+ console.error('deleteBackward err: ' + JSON.stringify(err));
}
```
@@ -1878,13 +1935,13 @@ deleteBackward(length:number): Promise<boolean>
```js
let length = 1;
inputClient.deleteBackward(length).then((result) => {
- if (result) {
- console.info('Succeeded in deleting backward. ');
- } else {
- console.error('Failed to deleteBackward. ');
- }
+ if (result) {
+ console.log('Succeeded in deleting backward.');
+ } else {
+ console.error('Failed to deleteBackward.');
+ }
}).catch((err) => {
- console.error('Failed to deleteBackward: ' + JSON.stringify(err));
+ console.error(`Failed to deleteBackward: ${JSON.stringify(err)}`);
});
```
@@ -1916,15 +1973,15 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
```js
inputClient.insertText('test', (err, result) => {
- if (err !== undefined) {
- console.error('Failed to insertText: ' + JSON.stringify(err));
- return;
- }
- if (result) {
- console.info('Succeeded in inserting text. ');
- } else {
- console.error('Failed to insertText. ');
- }
+ if (err) {
+ console.error(`Failed to insertText: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in inserting text.');
+ } else {
+ console.error('Failed to insertText.');
+ }
});
```
@@ -1961,17 +2018,17 @@ insertText(text:string): Promise<boolean>
```js
try {
- inputClient.insertText('test').then((result) => {
- if (result) {
- console.info('Succeeded in inserting text. ');
- } else {
- console.error('Failed to insertText. ');
- }
- }).catch((err) => {
- console.error('Failed to insertText: ' + JSON.stringify(err));
- });
+ inputClient.insertText('test').then((result) => {
+ if (result) {
+ console.log('Succeeded in inserting text.');
+ } else {
+ console.error('Failed to insertText.');
+ }
+ }).catch((err) => {
+ console.error(`Failed to insertText: ${JSON.stringify(err)}`);
+ });
} catch (err) {
- console.error('Failed to insertText: ' + JSON.stringify(err));
+ console.error(`Failed to insertText: ${JSON.stringify(err)}`);
}
```
@@ -2001,12 +2058,12 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
```js
inputClient.getEditorAttribute((err, editorAttribute) => {
- if (err !== undefined) {
- console.error('Failed to getEditorAttribute: ' + JSON.stringify(err));
- return;
- }
- console.log('editorAttribute.inputPattern: ' + JSON.stringify(editorAttribute.inputPattern));
- console.log('editorAttribute.enterKeyType: ' + JSON.stringify(editorAttribute.enterKeyType));
+ if (err) {
+ console.error(`Failed to getEditorAttribute: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('editorAttribute.inputPattern: ' + JSON.stringify(editorAttribute.inputPattern));
+ console.log('editorAttribute.enterKeyType: ' + JSON.stringify(editorAttribute.enterKeyType));
});
```
@@ -2036,10 +2093,10 @@ getEditorAttribute(): Promise<EditorAttribute>
```js
inputClient.getEditorAttribute().then((editorAttribute) => {
- console.info('editorAttribute.inputPattern: ' + JSON.stringify(editorAttribute.inputPattern));
- console.info('editorAttribute.enterKeyType: ' + JSON.stringify(editorAttribute.enterKeyType));
+ console.log('editorAttribute.inputPattern: ' + JSON.stringify(editorAttribute.inputPattern));
+ console.log('editorAttribute.enterKeyType: ' + JSON.stringify(editorAttribute.enterKeyType));
}).catch((err) => {
- console.error('Failed to getEditorAttribute: ' + JSON.stringify(err));
+ console.error(`Failed to getEditorAttribute: ${JSON.stringify(err)}`);
});
```
@@ -2070,15 +2127,15 @@ moveCursor(direction: number, callback: AsyncCallback<void>): void
```js
try {
- inputClient.moveCursor(inputMethodEngine.CURSOR_UP, (err) => {
- if (err !== undefined) {
- console.error('Failed to moveCursor: ' + JSON.stringify(err));
- return;
- }
- console.info('Succeeded in moving cursor.');
- });
+ inputClient.moveCursor(inputMethodEngine.CURSOR_UP, (err) => {
+ if (err) {
+ console.error(`Failed to moveCursor: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in moving cursor.');
+ });
} catch (err) {
- console.error('Failed to moveCursor: ' + JSON.stringify(err));
+ console.error(`Failed to moveCursor: ${JSON.stringify(err)}`);
}
```
@@ -2114,13 +2171,13 @@ moveCursor(direction: number): Promise<void>
```js
try {
- inputClient.moveCursor(inputMethodEngine.CURSOR_UP).then(() => {
- console.log('Succeeded in moving cursor.');
- }).catch((err) => {
- console.error('Failed to moveCursor: ' + JSON.stringify(err));
- });
+ inputClient.moveCursor(inputMethodEngine.CURSOR_UP).then(() => {
+ console.log('Succeeded in moving cursor.');
+ }).catch((err) => {
+ console.error(`Failed to moveCursor: ${JSON.stringify(err)}`);
+ });
} catch (err) {
- console.log('Failed to moveCursor: ' + JSON.stringify(err));
+ console.error(`Failed to moveCursor: ${JSON.stringify(err)}`);
}
```
@@ -2136,7 +2193,7 @@ selectByRange(range: Range, callback: AsyncCallback<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
-| range | [Range](./js-apis-inputmethod-InputMethodCommon.md#range) | 是 | 选中文本的范围。 |
+| range | [Range](#range10) | 是 | 选中文本的范围。 |
| callback | AsyncCallback<void> | 是 | 回调函数。当成功发送选中事件后,err为undefined,否则为错误对象。 |
**错误码:**
@@ -2152,15 +2209,15 @@ selectByRange(range: Range, callback: AsyncCallback<void>): void
```js
try {
- inputClient.selectByRange({start: 0, end: 1}, (err) => {
- if (err !== undefined) {
- console.error('Failed to selectByRange: ${err.message}');
- return;
- }
- console.info('Succeeded in selecting by range.');
- });
+ inputClient.selectByRange({start: 0, end: 1}, (err) => {
+ if (err) {
+ console.error(`Failed to selectByRange: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in selecting by range.');
+ });
} catch (err) {
- console.error('Failed to selectByRange: ${err.message}');
+ console.error(`Failed to selectByRange: ${JSON.stringify(err)}`);
}
```
@@ -2176,7 +2233,7 @@ selectByRange(range: Range): Promise<void>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | --------------------------------------------------------- | ---- | ---------------- |
-| range | [Range](./js-apis-inputmethod-InputMethodCommon.md#range) | 是 | 选中文本的范围。 |
+| range | [Range](#range10) | 是 | 选中文本的范围。 |
**返回值:**
@@ -2197,13 +2254,13 @@ selectByRange(range: Range): Promise<void>
```js
try {
- inputClient.selectByRange({start: 0, end:1}).then(() => {
- console.log('Succeeded in selecting by range.');
- }).catch((err) => {
- console.error('Failed to selectByRange: ${err.message}');
- });
+ inputClient.selectByRange({start: 0, end:1}).then(() => {
+ console.log('Succeeded in selecting by range.');
+ }).catch((err) => {
+ console.error(`Failed to selectByRange: ${JSON.stringify(err)}`);
+ });
} catch (err) {
- console.log('Failed to selectByRange: ${err.message}');
+ console.error(`Failed to selectByRange: ${JSON.stringify(err)}`);
}
```
@@ -2217,10 +2274,10 @@ selectByMovement(movement: Movement, callback: AsyncCallback<void>): void
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| movement | [Movement](./js-apis-inputmethod-InputMethodCommon.md#movement) | 是 | 选中时光标移动的方向。 |
-| callback | AsyncCallback<void> | 是 | 回调函数。当成功发送选中事件后,err为undefined,否则为错误对象。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | ------ |
+| movement | [Movement](#movement10) | 是 | 选中时光标移动的方向。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当成功发送选中事件后,err为undefined,否则为错误对象。 |
**错误码:**
@@ -2235,15 +2292,15 @@ selectByMovement(movement: Movement, callback: AsyncCallback<void>): void
```js
try {
- inputClient.selectByMovement({direction: 1}, (err) => {
- if (err !== undefined) {
- console.error('Failed to selectByMovement: ${err.message}');
- return;
- }
- console.info('Succeeded in selecting by movement.');
- });
+ inputClient.selectByMovement({direction: 1}, (err) => {
+ if (err) {
+ console.error(`Failed to selectByMovement: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in selecting by movement.');
+ });
} catch (err) {
- console.error('Failed to selectByMovement: ${err.message}');
+ console.error(`Failed to selectByMovement: ${JSON.stringify(err)}`);
}
```
@@ -2259,7 +2316,7 @@ selectByMovement(movement: Movement): Promise<void>
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ---------------------- |
-| movement | [Movement](./js-apis-inputmethod-InputMethodCommon.md#movement) | 是 | 选中时光标移动的方向。 |
+| movement | [Movement](#movement10) | 是 | 选中时光标移动的方向。 |
**返回值:**
@@ -2280,13 +2337,13 @@ selectByMovement(movement: Movement): Promise<void>
```js
try {
- inputClient.selectByMovement({direction: 1}).then(() => {
- console.log('Succeeded in selecting by movement.');
- }).catch((err) => {
- console.error('Failed to selectByMovement: ${err.message}');
- });
+ inputClient.selectByMovement({direction: 1}).then(() => {
+ console.log('Succeeded in selecting by movement.');
+ }).catch((err) => {
+ console.error(`Failed to selectByMovement: ${JSON.stringify(err)}`);
+ });
} catch (err) {
- console.log('Failed to selectByMovement: ${err.message}');
+ console.error(`Failed to selectByMovement: ${JSON.stringify(err)}`);
}
```
@@ -2310,7 +2367,6 @@ getTextIndexAtCursor(callback: AsyncCallback<number>): void
| 错误码ID | 错误信息 |
| -------- | ------------------------------ |
-| 401 | parameter error. |
| 12800003 | input method client error. |
| 12800006 | Input method controller error. |
@@ -2318,11 +2374,11 @@ getTextIndexAtCursor(callback: AsyncCallback<number>): void
```js
inputClient.getTextIndexAtCursor((err, index) => {
- if (err !== undefined) {
- console.error('Failed to getTextIndexAtCursor: ${err.message}');
- return;
- }
- console.info('Succeeded in getTextIndexAtCursor: ' + index);
+ if (err) {
+ console.error(`Failed to getTextIndexAtCursor: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in getTextIndexAtCursor: ' + index);
});
```
@@ -2353,12 +2409,99 @@ getTextIndexAtCursor(): Promise<number>
```js
inputClient.getTextIndexAtCursor().then((index) => {
- console.info('Succeeded in getTextIndexAtCursor: ' + index);
+ console.log('Succeeded in getTextIndexAtCursor: ' + index);
}).catch((err) => {
- console.error('Failed to getTextIndexAtCursor: ${err.message}');
+ console.error(`Failed to getTextIndexAtCursor: ${JSON.stringify(err)}`);
});
```
+### sendExtendAction10+
+
+sendExtendAction(action: ExtendAction, callback: AsyncCallback<void>): void
+
+发送扩展编辑操作。使用callback异步回调。
+
+输入法应用调用该接口向编辑控件(如:输入框)发送扩展编辑操作,编辑控件监听相应事件[on(handleExtendAction)](./js-apis-inputmethod.md#onhandleextendaction10),从而进一步做出处理。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------------- | ---- | ------------------------------------------------------------ |
+| action | [ExtendAction](#extendaction10) | 是 | 要发送的扩展操作。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。发送成功,err为undefined,否则为错误对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ------------------------------ |
+| 12800003 | input method client error. |
+| 12800006 | Input method controller error. |
+
+**示例:**
+
+```js
+try {
+ inputClient.sendExtendAction(inputMethodEngine.ExtendAction.COPY, (err) => {
+ if (err) {
+ console.error(`Failed to sendExtendAction: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in sending extend action.');
+ });
+} catch(err) {
+ console.error(`Failed to sendExtendAction: ${JSON.stringify(err)}`);
+}
+```
+
+### sendExtendAction10+
+
+sendExtendAction(action: ExtendAction): Promise<void>
+
+发送扩展编辑操作。使用promise异步回调。
+
+输入法应用调用该接口向编辑控件(如:输入框)发送扩展编辑操作,编辑控件监听相应事件[on(handleExtendAction)](./js-apis-inputmethod.md#onhandleextendaction10),从而进一步做出处理。
+
+**系统能力:** SystemCapability.MiscServices.InputMethodFramework
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| action | [ExtendAction](#extendaction10) | 是 | 要发送的扩展操作。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| --------------------- | --------------------------------------- |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+**错误码:**
+
+以下错误码的详细介绍请参见[输入法框架错误码](../errorcodes/errorcode-inputmethod-framework.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ------------------------------ |
+| 12800003 | Input method client error. |
+| 12800006 | Input method controller error. |
+
+**示例:**
+
+```js
+try {
+ inputClient.sendExtendAction(inputMethodEngine.ExtendAction.COPY).then(() => {
+ console.log('Succeeded in sending extend action.');
+ }).catch((err) => {
+ console.error(`Failed to sendExtendAction: ${JSON.stringify(err)}`);
+ });
+} catch(err) {
+ console.error(`Failed to sendExtendAction: ${JSON.stringify(err)}`);
+}
+```
+
## EditorAttribute
编辑框属性值。
@@ -2418,7 +2561,7 @@ inputClient.getTextIndexAtCursor().then((index) => {
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[InputClient](#inputclient9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[InputClient](#inputclient9)替代。
下列API示例中都需使用[on('inputStart')](#oninputstart)回调获取到TextInputClient实例,再通过此实例调用对应方法。
@@ -2430,7 +2573,7 @@ getForward(length:number, callback: AsyncCallback<string>): void
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[getForward](#getforward9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[getForward](#getforward9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -2446,11 +2589,11 @@ getForward(length:number, callback: AsyncCallback<string>): void
```js
let length = 1;
textInputClient.getForward(length, (err, text) => {
- if (err !== undefined) {
- console.error('Failed to getForward: ' + JSON.stringify(err));
- return;
- }
- console.log('Succeeded in getting forward, text: ' + text);
+ if (err) {
+ console.error(`Failed to getForward: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in getting forward, text: ' + text);
});
```
@@ -2462,7 +2605,7 @@ getForward(length:number): Promise<string>
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[getForward](#getforward9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[getForward](#getforward9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -2483,9 +2626,9 @@ getForward(length:number): Promise<string>
```js
let length = 1;
textInputClient.getForward(length).then((text) => {
- console.info('Succeeded in getting forward, text: ' + text);
+ console.log('Succeeded in getting forward, text: ' + text);
}).catch((err) => {
- console.error('Failed to getForward: ' + JSON.stringify(err));
+ console.error(`Failed to getForward: ${JSON.stringify(err)}`);
});
```
@@ -2497,7 +2640,7 @@ getBackward(length:number, callback: AsyncCallback<string>): void
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[getBackward](#getbackward9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[getBackward](#getbackward9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -2513,11 +2656,11 @@ getBackward(length:number, callback: AsyncCallback<string>): void
```js
let length = 1;
textInputClient.getBackward(length, (err, text) => {
- if (err !== undefined) {
- console.error('Failed to getBackward: ' + JSON.stringify(err));
- return;
- }
- console.log('Succeeded in getting borward, text: ' + text);
+ if (err) {
+ console.error(`Failed to getBackward: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('Succeeded in getting borward, text: ' + text);
});
```
@@ -2529,7 +2672,7 @@ getBackward(length:number): Promise<string>
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[getBackward](#getbackward9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[getBackward](#getbackward9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -2550,9 +2693,9 @@ getBackward(length:number): Promise<string>
```js
let length = 1;
textInputClient.getBackward(length).then((text) => {
- console.info('Succeeded in getting backward: ' + JSON.stringify(text));
+ console.log('Succeeded in getting backward: ' + JSON.stringify(text));
}).catch((err) => {
- console.error('Failed to getBackward: ' + JSON.stringify(err));
+ console.error(`Failed to getBackward: ${JSON.stringify(err)}`);
});
```
@@ -2564,7 +2707,7 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteForward](#deleteforward9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[deleteForward](#deleteforward9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -2580,15 +2723,15 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
```js
let length = 1;
textInputClient.deleteForward(length, (err, result) => {
- if (err !== undefined) {
- console.error('Failed to deleteForward: ' + JSON.stringify(err));
- return;
- }
- if (result) {
- console.info('Succeeded in deleting forward. ');
- } else {
- console.error('Failed to deleteForward. ');
- }
+ if (err) {
+ console.error(`Failed to deleteForward: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in deleting forward.');
+ } else {
+ console.error('Failed to deleteForward.');
+ }
});
```
@@ -2600,7 +2743,7 @@ deleteForward(length:number): Promise<boolean>
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteForward](#deleteforward9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[deleteForward](#deleteforward9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -2621,13 +2764,13 @@ deleteForward(length:number): Promise<boolean>
```js
let length = 1;
textInputClient.deleteForward(length).then((result) => {
- if (result) {
- console.info('Succeeded in deleting forward. ');
- } else {
- console.error('Failed to delete forward. ');
- }
+ if (result) {
+ console.log('Succeeded in deleting forward.');
+ } else {
+ console.error('Failed to delete forward.');
+ }
}).catch((err) => {
- console.error('Failed to delete forward: ' + JSON.stringify(err));
+ console.error(`Failed to deleteForward: ${JSON.stringify(err)}`);
});
```
@@ -2639,31 +2782,31 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteBackward](#deletebackward9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[deleteBackward](#deletebackward9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
- **参数:**
+**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | -------------- |
| length | number | 是 | 文本长度。 |
| callback | AsyncCallback<boolean> | 是 | 回调函数。当光标后固定长度的文本删除成功,err为undefined,data为true;否则为错误对象。|
- **示例:**
+**示例:**
```js
let length = 1;
textInputClient.deleteBackward(length, (err, result) => {
- if (err !== undefined) {
- console.error('Failed to delete backward: ' + JSON.stringify(err));
- return;
- }
- if (result) {
- console.info('Succeeded in deleting backward. ');
- } else {
- console.error('Failed to deleteBackward. ');
- }
+ if (err) {
+ console.error(`Failed to deleteBackward: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in deleting backward.');
+ } else {
+ console.error('Failed to deleteBackward.');
+ }
});
```
@@ -2675,7 +2818,7 @@ deleteBackward(length:number): Promise<boolean>
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[deleteBackward](#deletebackward9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[deleteBackward](#deletebackward9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -2696,13 +2839,13 @@ deleteBackward(length:number): Promise<boolean>
```js
let length = 1;
textInputClient.deleteBackward(length).then((result) => {
- if (result) {
- console.info('Succeeded in deleting backward. ');
- } else {
- console.error('Failed to deleteBackward. ');
- }
+ if (result) {
+ console.log('Succeeded in deleting backward.');
+ } else {
+ console.error('Failed to deleteBackward.');
+ }
}).catch((err) => {
- console.error('Failed to deleteBackward: ' + JSON.stringify(err));
+ console.error(`Failed to deleteBackward: ${JSON.stringify(err)}`);
});
```
### sendKeyFunction(deprecated)
@@ -2713,31 +2856,31 @@ sendKeyFunction(action: number, callback: AsyncCallback<boolean>): void
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[sendKeyFunction](#sendkeyfunction9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[sendKeyFunction](#sendkeyfunction9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
- **参数:**
+**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
-| action | number | 是 | 功能键键值。 当值为0时,表示无效按键; 当值为1时,表示确认键(即回车键)。 |
+| action | number | 是 | 功能键键值。 - 当值为0时,表示无效按键; - 当值为1时,表示确认键(即回车键)。 |
| callback | AsyncCallback<boolean> | 是 | 回调函数。当功能键发送成功,err为undefined,data为true;否则为错误对象。 |
- **示例:**
+**示例:**
```js
let action = 1;
textInputClient.sendKeyFunction(action, (err, result) => {
- if (err !== undefined) {
- console.error('Failed to sendKeyFunction: ' + JSON.stringify(err));
- return;
- }
- if (result) {
- console.info('Succeeded in sending key function. ');
- } else {
- console.error('Failed to sendKeyFunction. ');
- }
+ if (err) {
+ console.error(`Failed to sendKeyFunction: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in sending key function.');
+ } else {
+ console.error('Failed to sendKeyFunction.');
+ }
});
```
@@ -2749,7 +2892,7 @@ sendKeyFunction(action: number): Promise<boolean>
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[sendKeyFunction](#sendkeyfunction9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[sendKeyFunction](#sendkeyfunction9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -2770,13 +2913,13 @@ sendKeyFunction(action: number): Promise<boolean>
```js
let action = 1;
textInputClient.sendKeyFunction(action).then((result) => {
- if (result) {
- console.info('Succeeded in sending key function. ');
- } else {
- console.error('Failed to sendKeyFunction. ');
- }
+ if (result) {
+ console.log('Succeeded in sending key function.');
+ } else {
+ console.error('Failed to sendKeyFunction.');
+ }
}).catch((err) => {
- console.error('Failed to sendKeyFunction:' + JSON.stringify(err));
+ console.error(`Failed to sendKeyFunction: ${JSON.stringify(err)}`);
});
```
@@ -2788,7 +2931,7 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[insertText](#inserttext9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[insertText](#inserttext9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -2803,15 +2946,15 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
```js
textInputClient.insertText('test', (err, result) => {
- if (err !== undefined) {
- console.error('Failed to insertText: ' + JSON.stringify(err));
- return;
- }
- if (result) {
- console.info('Succeeded in inserting text. ');
- } else {
- console.error('Failed to insertText. ');
- }
+ if (err) {
+ console.error(`Failed to insertText: ${JSON.stringify(err)}`);
+ return;
+ }
+ if (result) {
+ console.log('Succeeded in inserting text.');
+ } else {
+ console.error('Failed to insertText.');
+ }
});
```
@@ -2823,7 +2966,7 @@ insertText(text:string): Promise<boolean>
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[insertText](#inserttext9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[insertText](#inserttext9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -2843,13 +2986,13 @@ insertText(text:string): Promise<boolean>
```js
textInputClient.insertText('test').then((result) => {
- if (result) {
- console.info('Succeeded in inserting text. ');
- } else {
- console.error('Failed to insertText. ');
- }
+ if (result) {
+ console.log('Succeeded in inserting text.');
+ } else {
+ console.error('Failed to insertText.');
+ }
}).catch((err) => {
- console.error('Failed to insertText: ' + JSON.stringify(err));
+ console.error(`Failed to insertText: ${JSON.stringify(err)}`);
});
```
@@ -2861,26 +3004,26 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[getEditorAttribute](#geteditorattribute9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[getEditorAttribute](#geteditorattribute9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----- | ----- | ----- |
| callback | AsyncCallback<[EditorAttribute](#editorattribute)> | 是 | 回调函数。当编辑框的属性值获取成功,err为undefined,data为编辑框属性值;否则为错误对象。|
**示例:**
```js
textInputClient.getEditorAttribute((err, editorAttribute) => {
- if (err !== undefined) {
- console.error('Failed to getEditorAttribute: ' + JSON.stringify(err));
- return;
- }
- console.log('editorAttribute.inputPattern: ' + JSON.stringify(editorAttribute.inputPattern));
- console.log('editorAttribute.enterKeyType: ' + JSON.stringify(editorAttribute.enterKeyType));
+ if (err) {
+ console.error(`Failed to getEditorAttribute: ${JSON.stringify(err)}`);
+ return;
+ }
+ console.log('editorAttribute.inputPattern: ' + JSON.stringify(editorAttribute.inputPattern));
+ console.log('editorAttribute.enterKeyType: ' + JSON.stringify(editorAttribute.enterKeyType));
});
```
@@ -2892,7 +3035,7 @@ getEditorAttribute(): Promise<EditorAttribute>
> **说明:**
>
-> 从API version 8开始支持,API version 9开始废弃, 建议使用[getEditorAttribute](#geteditorattribute9)替代。
+> 从API version 8开始支持,API version 9开始废弃,建议使用[getEditorAttribute](#geteditorattribute9)替代。
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
@@ -2906,10 +3049,10 @@ getEditorAttribute(): Promise<EditorAttribute>
```js
textInputClient.getEditorAttribute().then((editorAttribute) => {
- console.info('editorAttribute.inputPattern: ' + JSON.stringify(editorAttribute.inputPattern));
- console.info('editorAttribute.enterKeyType: ' + JSON.stringify(editorAttribute.enterKeyType));
+ console.log('editorAttribute.inputPattern: ' + JSON.stringify(editorAttribute.inputPattern));
+ console.log('editorAttribute.enterKeyType: ' + JSON.stringify(editorAttribute.enterKeyType));
}).catch((err) => {
- console.error('Failed to getEditorAttribute: ' + JSON.stringify(err));
+ console.error(`Failed to getEditorAttribute: ${JSON.stringify(err)}`);
});
```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-installer.md b/zh-cn/application-dev/reference/apis/js-apis-installer.md
index e8b465eab13a81937764a2f613edccf74935bb83..937c53f90891e61d500dc310f3440550fc7b9885 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-installer.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-installer.md
@@ -121,7 +121,7 @@ install(hapFilePaths: Array<string>, installParam: InstallParam, callback:
| 17700036 | Failed to install the HSP because lacks appropriate permissions. |
| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
| 17700041 | Failed to install because enterprise device management disallow install. |
-| 17700044 | Failed to install because the isolationMode does not match the system. |
+| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
**示例:**
@@ -185,7 +185,7 @@ install(hapFilePaths: Array<string>, callback: AsyncCallback<void>):
| 17700036 | Failed to install the HSP because lacks appropriate permissions. |
| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
| 17700041 | Failed to install because enterprise device management disallow install. |
-| 17700044 | Failed to install because the isolationMode does not match the system. |
+| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
**示例:**
@@ -253,7 +253,7 @@ install(hapFilePaths: Array\, installParam?: InstallParam) : Promise\ | 否 | 不使用代理服务器的屏蔽列表。 |
+| exclusionList | Array | 否 | 不使用代理服务器的屏蔽列表,列表内元素拼接后长度不可超过96字节。 例如:“baidu.com,zhihu.com”为20字节。 |
## NetSpecifier
diff --git a/zh-cn/application-dev/reference/apis/js-apis-request.md b/zh-cn/application-dev/reference/apis/js-apis-request.md
index 63a22eccec7fd3f8fa61062dece0e44983b8c4ab..15e0e0d13b567f33ab82e3573b9ed28e128126aa 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-request.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-request.md
@@ -1613,7 +1613,7 @@ resume(callback: AsyncCallback<void>): void
| enableMetered | boolean | 否 | 设置是否允许在按流量计费的连接下下载(默认使用false)。 - true:是 - false:否 |
| enableRoaming | boolean | 否 | 设置是否允许在漫游网络中下载(默认使用false)。 - true:是 - false:否|
| description | string | 否 | 设置下载会话的描述。 |
-| filePath7+ | string | 否 | 设置下载路径。 - filePath:'/data/storage/el2/base/haps/entry/files/test.txt':将文件存储在绝对路径下。 - FA模型下使用[context](js-apis-inner-app-context.md#contextgetcachedir) 获取应用存储路径,比如:\`${featureAbility.getContext().getFilesDir()}/test.txt\`,并将文件存储在此路径下。 - Stage模型下使用[AbilityContext](js-apis-inner-application-context.md) 类获取文件路径,比如:\`${globalThis.abilityContext.tempDir}/test.txt\`,并将文件存储在此路径下。|
+| filePath7+ | string | 否 | 设置下载路径。 - FA模型下使用[context](js-apis-inner-app-context.md#contextgetcachedir) 获取应用存储路径,比如:\`${featureAbility.getContext().getFilesDir()}/test.txt\`,并将文件存储在此路径下。 - Stage模型下使用[AbilityContext](js-apis-inner-application-context.md) 类获取文件路径,比如:\`${globalThis.abilityContext.tempDir}/test.txt\`,并将文件存储在此路径下。|
| networkType | number | 否 | 设置允许下载的网络类型(默认使用NETWORK_MOBILE&NETWORK_WIFI)。 - NETWORK_MOBILE:0x00000001 - NETWORK_WIFI:0x00010000|
| title | string | 否 | 设置下载任务名称。 |
| background9+ | boolean | 否 | 后台任务通知开关,开启后可在通知中显示下载状态(默认使用false)。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md
index df1336e85ba9f088fd1f0597f0dec03923ee2551..f404227b19024b1042585d57c08ba9577e139b3a 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md
@@ -1570,9 +1570,9 @@ FA卡片的使用信息的属性集合。
| 名称 | 类型 | 必填 | 说明 |
| --------------------- | ------ | ---- | ---------------------------------------- |
-| bundleName | string | 是 | 应用包名。 |
-| eventId | number | 是 | 应用事件类型。 |
-| eventOccurredTime | number | 是 | 应用事件发生的时间戳。 |
+| bundleName | string | 否 | 应用包名。 |
+| eventId | number | 否 | 应用事件类型。 |
+| eventOccurredTime | number | 否 | 应用事件发生的时间戳。 |
| appGroup | number | 否 | 应用程序的使用优先级组。|
| indexOfLink | string | 否 | 快捷方式id。|
| nameOfClass | string | 否 | 类名。|
diff --git a/zh-cn/application-dev/reference/apis/js-apis-taskpool.md b/zh-cn/application-dev/reference/apis/js-apis-taskpool.md
index 89d050ecfc85ab531f3e7e3b4b04dd8cc9de4248..5c1e76e9c42c58ac845df4cdc16264eb238aa6c1 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-taskpool.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-taskpool.md
@@ -19,7 +19,7 @@ import taskpool from '@ohos.taskpool';
## Priority
-表示所创建任务(Task)的优先级。(暂未支持)
+表示所创建任务(Task)的优先级。
**系统能力:** SystemCapability.Utils.Lang
@@ -29,6 +29,45 @@ import taskpool from '@ohos.taskpool';
| MEDIUM | 1 | 任务为中优先级。 |
| LOW | 2 | 任务为低优先级。 |
+**示例:**
+
+```ts
+function func(args) {
+ "use concurrent";
+ console.log("func: " + args);
+ return args;
+}
+async function taskpoolTest() {
+ let task = new taskpool.Task(func, 100);
+
+ let highCount = 0;
+ let mediumCount = 0;
+ let lowCount = 0;
+ let allCount = 100;
+ for (let i = 0; i < allCount; i++) {
+ taskpool.execute(task, taskpool.Priority.LOW).then((res: number) => {
+ lowCount++;
+ console.log("taskpool lowCount is :" + lowCount);
+ }).catch((e) => {
+ console.error("low task error: " + e);
+ })
+ taskpool.execute(task, taskpool.Priority.MEDIUM).then((res: number) => {
+ mediumCount++;
+ console.log("taskpool mediumCount is :" + mediumCount);
+ }).catch((e) => {
+ console.error("medium task error: " + e);
+ })
+ taskpool.execute(task, taskpool.Priority.HIGH).then((res: number) => {
+ highCount++;
+ console.log("taskpool highCount is :" + highCount);
+ }).catch((e) => {
+ console.error("high task error: " + e);
+ })
+ }
+}
+taskpoolTest();
+```
+
## Task
表示任务。使用以下方法前,需要先构造Task。
@@ -46,7 +85,7 @@ Task的构造函数。
| 参数名 | 类型 | 必填 | 说明 |
| ------ | --------- | ---- | -------------------------------------------------------------------- |
| func | Function | 是 | 任务执行需要传入函数,支持的函数返回值类型请查[序列化支持类型](#序列化支持类型)。 |
-| args | unknown[] | 否 | 任务执行传入函数的参数,支持的参数类型请查[序列化支持类型](#序列化支持类型)。 |
+| args | unknown[] | 否 | 任务执行传入函数的参数,支持的参数类型请查[序列化支持类型](#序列化支持类型)。默认值为undefined。 |
**错误码:**
@@ -81,7 +120,7 @@ let task = new taskpool.Task(func, "this is my first Task");
execute(func: Function, ...args: unknown[]): Promise\
-任务池执行任务,需要传入待执行的函数和函数所需的参数,此执行模式不可取消任务。
+将待执行的函数放入taskpool内部任务队列等待,等待分发到工作线程执行。当前执行模式不可取消任务。
**系统能力:** SystemCapability.Utils.Lang
@@ -90,7 +129,7 @@ execute(func: Function, ...args: unknown[]): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| ------ | --------- | ---- | ---------------------------------------------------------------------- |
| func | Function | 是 | 执行的逻辑需要传入函数,支持的函数返回值类型请查[序列化支持类型](#序列化支持类型)。 |
-| args | unknown[] | 否 | 执行逻辑的函数所需要的参数,支持的参数类型请查[序列化支持类型](#序列化支持类型)。 |
+| args | unknown[] | 否 | 执行逻辑的函数所需要的参数,支持的参数类型请查[序列化支持类型](#序列化支持类型)。默认值为undefined。 |
**返回值:**
@@ -129,16 +168,16 @@ taskpoolTest();
execute(task: Task, priority?: Priority): Promise\
-任务池执行任务,需要传入已创建的任务,此执行模式可取消任务。
+将创建好的任务放入taskpool内部任务队列等待,等待分发到工作线程执行。当前执行模式可尝试调用cancel进行任务取消。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | --------------------- | ---- | ------------------------------------ |
-| task | [Task](#task) | 是 | 需要在任务池中执行的任务。 |
-| priority | [Priority](#priority) | 否 | 等待执行的任务的优先级(暂未支持)。 |
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | --------------------- | ---- | ---------------------------------------- |
+| task | [Task](#task) | 是 | 需要在任务池中执行的任务。 |
+| priority | [Priority](#priority) | 否 | 等待执行的任务的优先级,该参数默认值为MEDIUM |
**返回值:**
@@ -197,18 +236,18 @@ cancel(task: Task): void
| 10200015 | If the task is not exist. |
| 10200016 | If the task is running. |
-**示例:**
+**任务取消成功示例:**
```ts
-@Concurrent
function func(args) {
+ "use concurrent";
console.log("func: " + args);
return args;
}
async function taskpoolTest() {
let task = new taskpool.Task(func, 100);
- let value = await taskpool.execute(task);
+ taskpool.execute(task);
try {
taskpool.cancel(task);
} catch (e) {
@@ -219,6 +258,66 @@ async function taskpoolTest() {
taskpoolTest();
```
+**已执行的任务取消失败示例:**
+
+```ts
+function func(args) {
+ "use concurrent";
+ console.log("func: " + args);
+ return args;
+}
+
+async function taskpoolTest() {
+ let task = new taskpool.Task(func, 100);
+ let value = taskpool.execute(task);
+ let start = new Date().getTime();
+ while (new Date().getTime() - start < 1000) { // 延时1s,确保任务已执行
+ continue;
+ }
+
+ try {
+ taskpool.cancel(task); //任务已执行,取消失败
+ } catch (e) {
+ console.log("taskpool.cancel occur error:" + e);
+ }
+}
+
+taskpoolTest();
+```
+
+**正在执行的任务取消失败示例:**
+
+```ts
+function func(args) {
+ "use concurrent";
+ console.log("func: " + args);
+ return args;
+}
+
+async function taskpoolTest() {
+ let task1 = new taskpool.Task(func, 100);
+ let task2 = new taskpool.Task(func, 200);
+ let task3 = new taskpool.Task(func, 300);
+ let task4 = new taskpool.Task(func, 400);
+ let task5 = new taskpool.Task(func, 500);
+ let task6 = new taskpool.Task(func, 600);
+
+ let res1 = taskpool.execute(task1);
+ let res2 = taskpool.execute(task2);
+ let res3 = taskpool.execute(task3);
+ let res4 = taskpool.execute(task4);
+ let res5 = taskpool.execute(task5);
+ let res6 = taskpool.execute(task6);
+ try {
+ taskpool.cancel(task1); // task1任务正在执行,取消失败
+ } catch (e) {
+ console.log("taskpool.cancel occur error:" + e);
+ }
+}
+
+taskpoolTest();
+```
+
## 其他说明
### 序列化支持类型
diff --git a/zh-cn/application-dev/reference/apis/js-apis-window.md b/zh-cn/application-dev/reference/apis/js-apis-window.md
index 0994ad1615e8dd2616eb543a394076d00ade2ba8..526989e2cd2e5d833d4f8a5ee4941fb519efce98 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-window.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-window.md
@@ -2701,7 +2701,7 @@ try {
### off('avoidAreaChange')9+
-off(type: 'avoidAreaChange', callback: Callback<{AvoidAreaType, AvoidArea}>): void
+off(type: 'avoidAreaChange', callback?: Callback<{AvoidAreaType, AvoidArea}>): void
关闭系统规避区变化的监听。
@@ -3471,7 +3471,7 @@ let colorSpace = windowClass.getWindowColorSpace();
setWindowBackgroundColor(color: string): void
-设置窗口的背景色。Stage模型下,该接口需要在[loadContent](#loadcontent9)之后使用。
+设置窗口的背景色。Stage模型下,该接口需要在[loadContent()](#loadcontent9)或[setUIContent()](#setuicontent9)调用生效后使用。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
@@ -6024,7 +6024,7 @@ promise.then((data)=> {
setBackgroundColor(color: string, callback: AsyncCallback<void>): void
-设置窗口的背景色,使用callback异步回调。Stage模型下,该接口需要在[loadContent](#loadcontent9)或[setUIContent()](#setuicontent9)之后使用。
+设置窗口的背景色,使用callback异步回调。Stage模型下,该接口需要在[loadContent()](#loadcontent9)或[setUIContent()](#setuicontent9)调用生效后使用。
> **说明:**
>
@@ -6056,7 +6056,7 @@ windowClass.setBackgroundColor(color, (err) => {
setBackgroundColor(color: string): Promise<void>
-设置窗口的背景色,使用Promise异步回调。Stage模型下,该接口需要在[loadContent](#loadcontent9)或[setUIContent()](#setuicontent9)之后使用。
+设置窗口的背景色,使用Promise异步回调。Stage模型下,该接口需要在[loadContent()](#loadcontent9)或[setUIContent()](#setuicontent9)调用生效后使用。
> **说明:**
>
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/#000000.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/000000.png
similarity index 100%
rename from zh-cn/application-dev/reference/arkui-js-lite/figures/#000000.png
rename to zh-cn/application-dev/reference/arkui-js-lite/figures/000000.png
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-common-styles.md b/zh-cn/application-dev/reference/arkui-js-lite/js-common-styles.md
index 48e1311e360318cab2a240d45d8e7075c5c5605b..00237e6734048877fb3fc70b7f4bdb793f461b70 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-common-styles.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-common-styles.md
@@ -4,184 +4,185 @@
组件普遍支持的可以在style或css中设置组件外观样式。
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。 未设置时组件宽度默认为0。 |
-| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。 未设置时组件高度默认为0。 |
-| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。 该属性可以有1到4个值: - 指定一个值时,该值指定四个边的内边距。 - 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。 - 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。 - 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 |
-| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 |
-| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。 - 只有一个值时,这个值会被指定给全部的四个边。 - 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。 - 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。 - 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 |
-| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 |
-| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 |
-| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 |
-| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 |
-| background-color | <color> | - | 否 | 设置背景颜色。 |
-| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 |
-| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为: - flex:弹性布局。 - none:不渲染此元素。 |
-| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。 - left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。 - top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| ---------------------------------- | ---------------------------------------- | ----- | ---- | ---------------------------------------- |
+| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。 未设置时组件宽度默认为0。 |
+| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。 未设置时组件高度默认为0。 |
+| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。 该属性可以有1到4个值: - 指定一个值时,该值指定四个边的内边距。 - 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。 - 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。 - 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 |
+| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 |
+| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。 - 只有一个值时,这个值会被指定给全部的四个边。 - 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。 - 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。 - 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 |
+| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 |
+| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 |
+| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 |
+| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 |
+| background-color | <color> | - | 否 | 设置背景颜色。 |
+| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 |
+| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为: - flex:弹性布局。 - none:不渲染此元素。 |
+| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。 - left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。 - top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 |
> **说明:**
+>
> 通用样式都不是必填项。
->
+>
> 目前,样式支持的颜色格式如下:
> - rgb(255, 255, 255)
->
+>
> - rgba(255, 255, 255, 1.0)
->
+>
> - HEX格式:\#rrggbb,\#aarrggbb
->
+>
> - 枚举格式:black,white等,详见 **表1** 当前支持的颜色枚举。Script脚本中不支持枚举格式。
**表1** 当前支持的颜色枚举
-| 枚举名称 | 对应颜色 | 颜色 |
-| -------- | -------- | -------- |
-| aliceblue | \#f0f8ff |  |
-| antiquewhite | \#faebd7 |  |
-| aqua | \#00ffff |  |
-| aquamarine | \#7fffd4 |  |
-| azure | \#f0ffff |  |
-| beige | \#f5f5dc |  |
-| bisque | \#ffe4c4 |  |
-| black | \#000000 |  |
-| blanchedalmond | \#ffebcd |  |
-| blue | \#0000ff |  |
-| blueviolet | \#8a2be2 |  |
-| brown | \#a52a2a |  |
-| burlywood | \#deB887 |  |
-| cadetblue | \#5f9ea0 |  |
-| chartreuse | \#7fff00 |  |
-| chocolate | \#d2691e |  |
-| coral | \#ff7f50 |  |
-| cornflowerblue | \#6495ed |  |
-| cornsilk | \#fff8dc |  |
-| crimson | \#dc143c |  |
-| cyan | \#00ffff |  |
-| darkblue | \#00008b |  |
-| darkcyan | \#008b8b |  |
-| darkgoldenrod | \#b8860b |  |
-| darkgray | \#a9a9a9 |  |
-| darkgreen | \#006400 |  |
-| darkgrey | \#a9a9a9 |  |
-| darkkhaki | \#bdb76b |  |
-| darkmagenta | \#8b008b |  |
-| darkolivegreen | \#556b2f |  |
-| darkorange | \#ff8c00 |  |
-| darkorchid | \#9932cc |  |
-| darkred | \#8b0000 |  |
-| darksalmon | \#e9967a |  |
-| darkseagreen | \#8fbc8f |  |
-| darkslateblue | \#483d8b |  |
-| darkslategray | \#2f4f4f |  |
-| darkslategrey | \#2f4f4f |  |
-| darkturquoise | \#00ced1 |  |
-| darkviolet | \#9400d3 |  |
-| deeppink | \#ff1493 |  |
-| deepskyblue | \#00bfff |  |
-| dimgray | \#696969 |  |
-| dimgrey | \#696969 |  |
-| dodgerblue | \#1e90ff |  |
-| firebrick | \#b22222 |  |
-| floralwhite | \#fffaf0 |  |
-| forestgreen | \#228b22 |  |
-| fuchsia | \#ff00ff |  |
-| gainsboro | \#dcdcdc |  |
-| ghostwhite | \#f8f8ff |  |
-| gold | \#ffd700 |  |
-| goldenrod | \#daa520 |  |
-| gray | \#808080 |  |
-| green | \#008000 |  |
-| greenyellow | \#adff2f |  |
-| grey | \#808080 |  |
-| honeydew | \#f0fff0 |  |
-| hotpink | \#ff69b4 |  |
-| indianred | \#cd5c5c |  |
-| indigo | \#4b0082 |  |
-| ivory | \#fffff0 |  |
-| khaki | \#f0e68c |  |
-| lavender | \#e6e6fa |  |
-| lavenderblush | \#fff0f5 |  |
-| lawngreen | \#7cfc00 |  |
-| lemonchiffon | \#fffacd |  |
-| lightblue | \#add8e6 |  |
-| lightcoral | \#f08080 |  |
-| lightcyan | \#e0ffff |  |
+| 枚举名称 | 对应颜色 | 颜色 |
+| -------------------- | -------- | ---------------------------------------- |
+| aliceblue | \#f0f8ff |  |
+| antiquewhite | \#faebd7 |  |
+| aqua | \#00ffff |  |
+| aquamarine | \#7fffd4 |  |
+| azure | \#f0ffff |  |
+| beige | \#f5f5dc |  |
+| bisque | \#ffe4c4 |  |
+| black | \#000000 |  |
+| blanchedalmond | \#ffebcd |  |
+| blue | \#0000ff |  |
+| blueviolet | \#8a2be2 |  |
+| brown | \#a52a2a |  |
+| burlywood | \#deB887 |  |
+| cadetblue | \#5f9ea0 |  |
+| chartreuse | \#7fff00 |  |
+| chocolate | \#d2691e |  |
+| coral | \#ff7f50 |  |
+| cornflowerblue | \#6495ed |  |
+| cornsilk | \#fff8dc |  |
+| crimson | \#dc143c |  |
+| cyan | \#00ffff |  |
+| darkblue | \#00008b |  |
+| darkcyan | \#008b8b |  |
+| darkgoldenrod | \#b8860b |  |
+| darkgray | \#a9a9a9 |  |
+| darkgreen | \#006400 |  |
+| darkgrey | \#a9a9a9 |  |
+| darkkhaki | \#bdb76b |  |
+| darkmagenta | \#8b008b |  |
+| darkolivegreen | \#556b2f |  |
+| darkorange | \#ff8c00 |  |
+| darkorchid | \#9932cc |  |
+| darkred | \#8b0000 |  |
+| darksalmon | \#e9967a |  |
+| darkseagreen | \#8fbc8f |  |
+| darkslateblue | \#483d8b |  |
+| darkslategray | \#2f4f4f |  |
+| darkslategrey | \#2f4f4f |  |
+| darkturquoise | \#00ced1 |  |
+| darkviolet | \#9400d3 |  |
+| deeppink | \#ff1493 |  |
+| deepskyblue | \#00bfff |  |
+| dimgray | \#696969 |  |
+| dimgrey | \#696969 |  |
+| dodgerblue | \#1e90ff |  |
+| firebrick | \#b22222 |  |
+| floralwhite | \#fffaf0 |  |
+| forestgreen | \#228b22 |  |
+| fuchsia | \#ff00ff |  |
+| gainsboro | \#dcdcdc |  |
+| ghostwhite | \#f8f8ff |  |
+| gold | \#ffd700 |  |
+| goldenrod | \#daa520 |  |
+| gray | \#808080 |  |
+| green | \#008000 |  |
+| greenyellow | \#adff2f |  |
+| grey | \#808080 |  |
+| honeydew | \#f0fff0 |  |
+| hotpink | \#ff69b4 |  |
+| indianred | \#cd5c5c |  |
+| indigo | \#4b0082 |  |
+| ivory | \#fffff0 |  |
+| khaki | \#f0e68c |  |
+| lavender | \#e6e6fa |  |
+| lavenderblush | \#fff0f5 |  |
+| lawngreen | \#7cfc00 |  |
+| lemonchiffon | \#fffacd |  |
+| lightblue | \#add8e6 |  |
+| lightcoral | \#f08080 |  |
+| lightcyan | \#e0ffff |  |
| lightgoldenrodyellow | \#fafad2 |  |
-| lightgray | \#d3d3d3 |  |
-| lightgreen | \#90ee90 |  |
-| lightpink | \#ffb6c1 |  |
-| lightsalmon | \#ffa07a |  |
-| lightseagreen | \#20b2aa |  |
-| lightskyblue | \#87cefa |  |
-| lightslategray | \#778899 |  |
-| lightslategrey | \#778899 |  |
-| lightsteelblue | \#b0c4de |  |
-| lightyellow | \#ffffe0 |  |
-| lime | \#00ff00 |  |
-| limegreen | \#32cd32 |  |
-| linen | \#faf0e6 |  |
-| magenta | \#ff00ff |  |
-| maroon | \#800000 |  |
-| mediumaquamarine | \#66cdaa |  |
-| mediumblue | \#0000cd |  |
-| mediumorchid | \#ba55d3 |  |
-| mediumpurple | \#9370db |  |
-| mediumseagreen | \#3cb371 |  |
-| mediumslateblue | \#7b68ee |  |
-| mediumspringgreen | \#00fa9a |  |
-| mediumturquoise | \#48d1cc |  |
-| mediumvioletred | \#c71585 |  |
-| midnightblue | \#191970 |  |
-| mintcream | \#f5fffa |  |
-| mistyrose | \#ffe4e1 |  |
-| moccasin | \#ffe4b5 |  |
-| navajowhite | \#ffdead |  |
-| navy | \#000080 |  |
-| oldlace | \#fdf5e6 |  |
-| olive | \#808000 |  |
-| olivedrab | \#6b8e23 |  |
-| orange | \#ffa500 |  |
-| orangered | \#ff4500 |  |
-| orchid | \#da70d6 |  |
-| palegoldenrod | \#eee8aa |  |
-| palegreen | \#98fb98 |  |
-| paleturquoise | \#afeeee |  |
-| palevioletred | \#db7093 |  |
-| papayawhip | \#ffefd5 |  |
-| peachpuff | \#ffdab9 |  |
-| peru | \#cd853f |  |
-| pink | \#ffc0cb |  |
-| plum | \#dda0dd |  |
-| powderblue | \#b0e0e6 |  |
-| purple | \#800080 |  |
-| rebeccapurple | \#663399 |  |
-| red | \#ff0000 |  |
-| rosybrown | \#bc8f8f |  |
-| royalblue | \#4169e1 |  |
-| saddlebrown | \#8b4513 |  |
-| salmon | \#fa8072 |  |
-| sandybrown | \#f4a460 |  |
-| seagreen | \#2e8b57 |  |
-| seashell | \#fff5ee |  |
-| sienna | \#a0522d |  |
-| silver | \#c0c0c0 |  |
-| skyblue | \#87ceeb |  |
-| slateblue | \#6a5acd |  |
-| slategray | \#708090 |  |
-| slategrey | \#708090 |  |
-| snow | \#fffafa |  |
-| springgreen | \#00ff7f |  |
-| steelblue | \#4682b4 |  |
-| tan | \#d2b48c |  |
-| teal | \#008080 |  |
-| thistle | \#d8Bfd8 |  |
-| tomato | \#ff6347 |  |
-| turquoise | \#40e0d0 |  |
-| violet | \#ee82ee |  |
-| wheat | \#f5deb3 |  |
-| white | \#ffffff |  |
-| whitesmoke | \#f5f5f5 |  |
-| yellow | \#ffff00 |  |
-| yellowgreen | \#9acd32 |  |
+| lightgray | \#d3d3d3 |  |
+| lightgreen | \#90ee90 |  |
+| lightpink | \#ffb6c1 |  |
+| lightsalmon | \#ffa07a |  |
+| lightseagreen | \#20b2aa |  |
+| lightskyblue | \#87cefa |  |
+| lightslategray | \#778899 |  |
+| lightslategrey | \#778899 |  |
+| lightsteelblue | \#b0c4de |  |
+| lightyellow | \#ffffe0 |  |
+| lime | \#00ff00 |  |
+| limegreen | \#32cd32 |  |
+| linen | \#faf0e6 |  |
+| magenta | \#ff00ff |  |
+| maroon | \#800000 |  |
+| mediumaquamarine | \#66cdaa |  |
+| mediumblue | \#0000cd |  |
+| mediumorchid | \#ba55d3 |  |
+| mediumpurple | \#9370db |  |
+| mediumseagreen | \#3cb371 |  |
+| mediumslateblue | \#7b68ee |  |
+| mediumspringgreen | \#00fa9a |  |
+| mediumturquoise | \#48d1cc |  |
+| mediumvioletred | \#c71585 |  |
+| midnightblue | \#191970 |  |
+| mintcream | \#f5fffa |  |
+| mistyrose | \#ffe4e1 |  |
+| moccasin | \#ffe4b5 |  |
+| navajowhite | \#ffdead |  |
+| navy | \#000080 |  |
+| oldlace | \#fdf5e6 |  |
+| olive | \#808000 |  |
+| olivedrab | \#6b8e23 |  |
+| orange | \#ffa500 |  |
+| orangered | \#ff4500 |  |
+| orchid | \#da70d6 |  |
+| palegoldenrod | \#eee8aa |  |
+| palegreen | \#98fb98 |  |
+| paleturquoise | \#afeeee |  |
+| palevioletred | \#db7093 |  |
+| papayawhip | \#ffefd5 |  |
+| peachpuff | \#ffdab9 |  |
+| peru | \#cd853f |  |
+| pink | \#ffc0cb |  |
+| plum | \#dda0dd |  |
+| powderblue | \#b0e0e6 |  |
+| purple | \#800080 |  |
+| rebeccapurple | \#663399 |  |
+| red | \#ff0000 |  |
+| rosybrown | \#bc8f8f |  |
+| royalblue | \#4169e1 |  |
+| saddlebrown | \#8b4513 |  |
+| salmon | \#fa8072 |  |
+| sandybrown | \#f4a460 |  |
+| seagreen | \#2e8b57 |  |
+| seashell | \#fff5ee |  |
+| sienna | \#a0522d |  |
+| silver | \#c0c0c0 |  |
+| skyblue | \#87ceeb |  |
+| slateblue | \#6a5acd |  |
+| slategray | \#708090 |  |
+| slategrey | \#708090 |  |
+| snow | \#fffafa |  |
+| springgreen | \#00ff7f |  |
+| steelblue | \#4682b4 |  |
+| tan | \#d2b48c |  |
+| teal | \#008080 |  |
+| thistle | \#d8Bfd8 |  |
+| tomato | \#ff6347 |  |
+| turquoise | \#40e0d0 |  |
+| violet | \#ee82ee |  |
+| wheat | \#f5deb3 |  |
+| white | \#ffffff |  |
+| whitesmoke | \#f5f5f5 |  |
+| yellow | \#ffff00 |  |
+| yellowgreen | \#9acd32 |  |
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-chart.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-chart.md
index 71730347c3280ff915655e5d916c4c97fa5e3693..fd8ea82d1b255962a099342721f72cd4c718e9e8 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-chart.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-chart.md
@@ -14,118 +14,118 @@
## 属性
-| 名称 | 类型 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| type | string | 否 | 设置图表类型(不支持动态修改),可选项有: - bar:柱状图。 - line:线形图。 默认值:line |
-| options | ChartOptions | 是 | 图表参数设置,柱状图和线形图必须设置参数设置。可以设置x轴、y轴的最小值、最大值、刻度数、是否显示,线条宽度、是否平滑等。(不支持动态修改) |
-| datasets | Array<ChartDataset> | 是 | 数据集合,柱状图和线形图必须设置数据集合。可以设置多条数据集及其背景色。 |
-| id | string | 否 | 组件的唯一标识。 |
-| style | string | 否 | 组件的样式声明。 |
-| class | string | 否 | 组件的样式类,用于引用样式表。 |
-| ref | string | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 |
+| 名称 | 类型 | 必填 | 描述 |
+| -------- | ------------------------- | ---- | ---------------------------------------- |
+| type | string | 否 | 设置图表类型(不支持动态修改),可选项有: - bar:柱状图。 - line:线形图。 默认值:line |
+| options | ChartOptions | 是 | 图表参数设置,柱状图和线形图必须设置参数设置。可以设置x轴、y轴的最小值、最大值、刻度数、是否显示,线条宽度、是否平滑等。(不支持动态修改) |
+| datasets | Array<ChartDataset> | 是 | 数据集合,柱状图和线形图必须设置数据集合。可以设置多条数据集及其背景色。 |
+| id | string | 否 | 组件的唯一标识。 |
+| style | string | 否 | 组件的样式声明。 |
+| class | string | 否 | 组件的样式类,用于引用样式表。 |
+| ref | string | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 |
- **表2** ChartOptions
+ **表1** ChartOptions
-| 名称 | 类型 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| xAxis | ChartAxis | 是 | x轴参数设置。可以设置x轴最小值、最大值、刻度数以及是否显示。 |
-| yAxis | ChartAxis | 是 | y轴参数设置。可以设置y轴最小值、最大值、刻度数以及是否显示。 |
-| series | ChartSeries | 否 | 数据序列参数设置。可以设置: 1. 线的样式,如线宽、是否平滑; 2. 设置线最前端位置白点的样式和大小。 **说明:** 仅线形图支持。 |
+| 名称 | 类型 | 必填 | 描述 |
+| ------ | ----------- | ---- | ---------------------------------------- |
+| xAxis | ChartAxis | 是 | x轴参数设置。可以设置x轴最小值、最大值、刻度数以及是否显示。 |
+| yAxis | ChartAxis | 是 | y轴参数设置。可以设置y轴最小值、最大值、刻度数以及是否显示。 |
+| series | ChartSeries | 否 | 数据序列参数设置。可以设置: 1. 线的样式,如线宽、是否平滑; 2. 设置线最前端位置白点的样式和大小。 **说明:** 仅线形图支持。 |
- **表3** ChartDataset
+ **表2** ChartDataset
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| backgroundColor(deprecated) | <color> | \#ff6384 | 否 | 设置线或柱的颜色(不推荐使用)。 |
-| strokeColor | <color> | \#ff6384 | 否 | 线条颜色。仅线形图支持。 |
-| fillColor | <color> | \#ff6384 | 否 | 填充颜色。线形图表示填充的渐变颜色。 |
-| data | Array<number> | - | 是 | 设置绘制线或柱中的点集。 |
-| gradient | boolean | false | 否 | 设置是否显示填充渐变颜色。仅线形图支持。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| --------------------------- | ------------------- | -------- | ---- | -------------------- |
+| backgroundColor(deprecated) | <color> | \#ff6384 | 否 | 设置线或柱的颜色(不推荐使用)。 |
+| strokeColor | <color> | \#ff6384 | 否 | 线条颜色。仅线形图支持。 |
+| fillColor | <color> | \#ff6384 | 否 | 填充颜色。线形图表示填充的渐变颜色。 |
+| data | Array<number> | - | 是 | 设置绘制线或柱中的点集。 |
+| gradient | boolean | false | 否 | 设置是否显示填充渐变颜色。仅线形图支持。 |
- **表4** ChartAxis
+ **表3** ChartAxis
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| min | number | 0 | 否 | 轴的最小值。 不支持负数。仅线形图支持。 |
-| max | number | 100 | 否 | 轴的最大值。 不支持负数。仅线形图支持。 |
-| axisTick | number | 10 | 否 | 轴显示的刻度数量。 **说明:** 仅支持1~20,且具体显示的效果与如下计算值有关(图的宽度所占的像素/(max-min))。 因轻量级智能穿戴为整型运行,在除不尽的情况下会有误差产生,具体的表现形式是x轴末尾可能会空出一段。 在柱状图中,每组数据显示的柱子数量与刻度数量一致,且柱子显示在刻度处。 |
-| display | boolean | false | 否 | 是否显示轴。 |
-| color | <color> | \#c0c0c0 | 否 | 轴颜色。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| -------- | ------------- | -------- | ---- | ---------------------------------------- |
+| min | number | 0 | 否 | 轴的最小值。 不支持负数。仅线形图支持。 |
+| max | number | 100 | 否 | 轴的最大值。 不支持负数。仅线形图支持。 |
+| axisTick | number | 10 | 否 | 轴显示的刻度数量。 **说明:** 仅支持1~20,且具体显示的效果与如下计算值有关(图的宽度所占的像素/(max-min))。 因轻量级智能穿戴为整型运行,在除不尽的情况下会有误差产生,具体的表现形式是x轴末尾可能会空出一段。 在柱状图中,每组数据显示的柱子数量与刻度数量一致,且柱子显示在刻度处。 |
+| display | boolean | false | 否 | 是否显示轴。 |
+| color | <color> | \#c0c0c0 | 否 | 轴颜色。 |
- **表5** ChartSeries
+ **表4** ChartSeries
-| 名称 | 类型 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| lineStyle | ChartLineStyle | 否 | 线样式设置,如线宽、是否平滑。 |
-| headPoint | PointStyle | 否 | 线最前端位置白点的样式和大小。 |
-| topPoint | PointStyle | 否 | 最高点的样式和大小。 |
-| bottomPoint | PointStyle | 否 | 最低点的样式和大小。 |
-| loop | ChartLoop | 否 | 设置屏幕显示满时,是否需要重头开始绘制。 |
+| 名称 | 类型 | 必填 | 描述 |
+| ----------- | -------------- | ---- | -------------------- |
+| lineStyle | ChartLineStyle | 否 | 线样式设置,如线宽、是否平滑。 |
+| headPoint | PointStyle | 否 | 线最前端位置白点的样式和大小。 |
+| topPoint | PointStyle | 否 | 最高点的样式和大小。 |
+| bottomPoint | PointStyle | 否 | 最低点的样式和大小。 |
+| loop | ChartLoop | 否 | 设置屏幕显示满时,是否需要重头开始绘制。 |
- **表6** ChartLineStyle
+ **表5** ChartLineStyle
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| width | <length> | 1px | 否 | 线宽设置。 |
-| smooth | boolean | false | 否 | 是否平滑。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| ------ | -------------- | ----- | ---- | ----- |
+| width | <length> | 1px | 否 | 线宽设置。 |
+| smooth | boolean | false | 否 | 是否平滑。 |
- **表7** PointStyle
+ **表6** PointStyle
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| shape | string | circle | 否 | 高亮点的形状。可选值为: - circle:圆形。 |
-| size | <length> | 5px | 否 | 高亮点的大小。 |
-| strokeWidth | <length> | 1px | 否 | 边框宽度 |
-| strokeColor | <color> | \#ff0000 | 否 | 边框颜色。 |
-| fillColor | <color> | \#ff0000 | 否 | 填充颜色。 |
-| display | boolean | true | 否 | 是否高亮显示。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| ----------- | -------------- | -------- | ---- | ---------------------------------- |
+| shape | string | circle | 否 | 高亮点的形状。可选值为: - circle:圆形。 |
+| size | <length> | 5px | 否 | 高亮点的大小。 |
+| strokeWidth | <length> | 1px | 否 | 边框宽度 |
+| strokeColor | <color> | \#ff0000 | 否 | 边框颜色。 |
+| fillColor | <color> | \#ff0000 | 否 | 填充颜色。 |
+| display | boolean | true | 否 | 是否高亮显示。 |
- **表8** ChartLoop
+ **表7** ChartLoop
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| margin | <length> | 1 | 否 | 擦除点的个数(最新绘制的点与最老的点之间的横向距离)。注意:轻量设备margin和topPoint/bottomPoint/headPoint同时使用时,有概率出现point正好位于擦除区域的情况,导致point不可见,因此不建议同时使用。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| ------ | -------------- | ---- | ---- | ---------------------------------------- |
+| margin | <length> | 1 | 否 | 擦除点的个数(最新绘制的点与最老的点之间的横向距离)。注意:轻量设备margin和topPoint/bottomPoint/headPoint同时使用时,有概率出现point正好位于擦除区域的情况,导致point不可见,因此不建议同时使用。 |
## 方法
-| 方法 | 参数 | 描述 |
-| -------- | -------- | -------- |
+| 方法 | 参数 | 描述 |
+| ------ | ---------------------------------------- | ---------------------------------------- |
| append | { serial: number, // 设置要更新的线形图数据下标 data: Array<number>, // 设置新增的数据 } | 往已有的数据序列中动态添加数据,根据serial指定目标序列,serial为datasets数组的下标,从0开始。注意:不会更新datasets[index].data。仅线形图支持,按横坐标加1递增(与xAxis min/max设置相关)。 |
## 事件
-| 名称 | 参数 | 描述 |
-| -------- | -------- | -------- |
-| click | - | 点击动作触发该事件。 |
-| longpress | - | 长按动作触发该事件。 |
+| 名称 | 参数 | 描述 |
+| ------------------ | --------------------------------- | ----------- |
+| click | - | 点击动作触发该事件。 |
+| longpress | - | 长按动作触发该事件。 |
| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 |
## 样式
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。 未设置时组件宽度默认为0。 |
-| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。 未设置时组件高度默认为0。 |
-| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。 该属性可以有1到4个值: - 指定一个值时,该值指定四个边的内边距。 - 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。 - 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。 - 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 |
-| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 |
-| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。 - 只有一个值时,这个值会被指定给全部的四个边。 - 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。 - 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。 - 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 |
-| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 |
-| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 |
-| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 |
-| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 |
-| background-color | <color> | - | 否 | 设置背景颜色。 |
-| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为: - flex:弹性布局。 - none:不渲染此元素。 |
-| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。 - left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。 - top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| ---------------------------------- | ---------------------------------------- | ----- | ---- | ---------------------------------------- |
+| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。 未设置时组件宽度默认为0。 |
+| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。 未设置时组件高度默认为0。 |
+| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。 该属性可以有1到4个值: - 指定一个值时,该值指定四个边的内边距。 - 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。 - 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。 - 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 |
+| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 |
+| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。 - 只有一个值时,这个值会被指定给全部的四个边。 - 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。 - 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。 - 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 |
+| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 |
+| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 |
+| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 |
+| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 |
+| background-color | <color> | - | 否 | 设置背景颜色。 |
+| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为: - flex:弹性布局。 - none:不渲染此元素。 |
+| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。 - left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。 - top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 |
## 示例
1. 线形图
-
+
```html
@@ -134,7 +134,7 @@
```
-
+
```css
/* xxx.css */
.container {
@@ -155,7 +155,7 @@
}
```
-
+
```js
// xxx.js
export default {
@@ -211,7 +211,7 @@

2. 柱状图
-
+
```html
@@ -219,7 +219,7 @@
```
-
+
```css
/* xxx.css */
.container {
@@ -236,7 +236,7 @@
}
```
-
+
```js
// xxx.js
export default {
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md
index 9c85c0e3808241dda5faad0aa459c627d5ed069b..d0db3c1abf138cca8c062bee7bfa73426908ab78 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md
@@ -14,68 +14,68 @@
## 属性
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| images | Array<ImageFrame> | - | 是 | 设置图片帧信息集合。每一帧的帧信息包含图片路径、图片大小和图片位置信息。目前支持以下图片格式:png、jpg和bmp。ImageFrame的详细说明请见表1。 **说明:** 使用时需要使用数据绑定的方式,如images = {{images}},js中声明相应变量:images: [{src: "/common/heart-rate01.png"}, {src: "/common/heart-rate02.png"}]。 |
-| iteration | number \| string | infinite | 否 | 设置帧动画播放次数。number表示固定次数,infinite枚举表示无限次数播放。 |
-| reverse | boolean | false | 否 | 设置播放顺序。false表示从第1张图片播放到最后1张图片; true表示从最后1张图片播放到第1张图片。 |
-| fixedsize | boolean | true | 否 | 设置图片大小是否固定为组件大小。 true表示图片大小与组件大小一致,此时设置图片的width 、height 、top 和left属性是无效的。false表示每一张图片的 width 、height 、top和left属性都要单独设置。 |
-| duration | string | - | 是 | 设置单次播放时长。单位支持[s(秒)\|ms(毫秒)],默认单位为ms。 duration为0时,不播放图片。 值改变只会在下一次循环开始时生效。 |
-| fillmode5+ | string | forwards | 否 | 指定帧动画执行结束后的状态。可选项有: - none:恢复初始状态。 - forwards:保持帧动画结束时的状态(在最后一个关键帧中定义)。 |
-| id | string | - | 否 | 组件的唯一标识。 |
-| style | string | - | 否 | 组件的样式声明。 |
-| class | string | - | 否 | 组件的样式类,用于引用样式表。 |
-| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 |
-
- **表2** ImageFrame说明
-
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| src | <uri> | - | 是 | 图片路径。 |
-| width | <length> | 0 | 否 | 图片宽度。 |
-| height | <length> | 0 | 否 | 图片高度。 |
-| top | <length> | 0 | 否 | 图片相对于组件左上角的纵向坐标。 |
-| left | <length> | 0 | 否 | 图片相对于组件左上角的横向坐标。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| --------------------- | -------------------------- | -------- | ---- | ---------------------------------------- |
+| images | Array<ImageFrame> | - | 是 | 设置图片帧信息集合。每一帧的帧信息包含图片路径、图片大小和图片位置信息。目前支持以下图片格式:png、jpg和bmp。ImageFrame的详细说明请见表1。 **说明:** 使用时需要使用数据绑定的方式,如images = {{images}},js中声明相应变量:images: [{src: "/common/heart-rate01.png"}, {src: "/common/heart-rate02.png"}]。 |
+| iteration | number \| string | infinite | 否 | 设置帧动画播放次数。number表示固定次数,infinite枚举表示无限次数播放。 |
+| reverse | boolean | false | 否 | 设置播放顺序。false表示从第1张图片播放到最后1张图片; true表示从最后1张图片播放到第1张图片。 |
+| fixedsize | boolean | true | 否 | 设置图片大小是否固定为组件大小。 true表示图片大小与组件大小一致,此时设置图片的width 、height 、top 和left属性是无效的。false表示每一张图片的 width 、height 、top和left属性都要单独设置。 |
+| duration | string | - | 是 | 设置单次播放时长。单位支持[s(秒)\|ms(毫秒)],默认单位为ms。 duration为0时,不播放图片。 值改变只会在下一次循环开始时生效。 |
+| fillmode5+ | string | forwards | 否 | 指定帧动画执行结束后的状态。可选项有: - none:恢复初始状态。 - forwards:保持帧动画结束时的状态(在最后一个关键帧中定义)。 |
+| id | string | - | 否 | 组件的唯一标识。 |
+| style | string | - | 否 | 组件的样式声明。 |
+| class | string | - | 否 | 组件的样式类,用于引用样式表。 |
+| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 |
+
+ **表1** ImageFrame说明
+
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| ------ | -------------- | ---- | ---- | ---------------- |
+| src | <uri> | - | 是 | 图片路径。 |
+| width | <length> | 0 | 否 | 图片宽度。 |
+| height | <length> | 0 | 否 | 图片高度。 |
+| top | <length> | 0 | 否 | 图片相对于组件左上角的纵向坐标。 |
+| left | <length> | 0 | 否 | 图片相对于组件左上角的横向坐标。 |
## 事件
-| 名称 | 参数 | 描述 |
-| -------- | -------- | -------- |
-| stop | - | 帧动画结束时触发。 |
-| click | - | 点击动作触发该事件。 |
-| longpress | - | 长按动作触发该事件。 |
+| 名称 | 参数 | 描述 |
+| ------------------ | --------------------------------- | ----------- |
+| stop | - | 帧动画结束时触发。 |
+| click | - | 点击动作触发该事件。 |
+| longpress | - | 长按动作触发该事件。 |
| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 |
## 样式
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。 未设置时组件宽度默认为0。 |
-| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。 未设置时组件高度默认为0。 |
-| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。 该属性可以有1到4个值: - 指定一个值时,该值指定四个边的内边距。 - 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。 - 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。 - 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 |
-| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 |
-| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。 - 只有一个值时,这个值会被指定给全部的四个边。 - 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。 - 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。 - 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 |
-| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 |
-| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 |
-| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 |
-| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 |
-| background-color | <color> | - | 否 | 设置背景颜色。 |
-| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 |
-| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为: - flex:弹性布局。 - none:不渲染此元素。 |
-| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。 - left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。 - top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| ---------------------------------- | ---------------------------------------- | ----- | ---- | ---------------------------------------- |
+| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。 未设置时组件宽度默认为0。 |
+| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。 未设置时组件高度默认为0。 |
+| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。 该属性可以有1到4个值: - 指定一个值时,该值指定四个边的内边距。 - 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。 - 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。 - 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 |
+| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 |
+| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。 - 只有一个值时,这个值会被指定给全部的四个边。 - 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。 - 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。 - 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 |
+| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 |
+| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 |
+| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 |
+| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 |
+| background-color | <color> | - | 否 | 设置背景颜色。 |
+| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 |
+| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为: - flex:弹性布局。 - none:不渲染此元素。 |
+| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。 - left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。 - top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 |
## 方法
-| 名称 | 参数 | 描述 |
-| -------- | -------- | -------- |
-| start | - | 开始播放图片帧动画。再次调用,重新从第1帧开始播放。 |
-| pause | - | 暂停播放图片帧动画。 |
-| stop | - | 停止播放图片帧动画。 |
-| resume | - | 继续播放图片帧。 |
-| getState | - | 获取播放状态。可能值有: - playing:播放中 - paused:已暂停 - stopped:已停止。 |
+| 名称 | 参数 | 描述 |
+| -------- | ---- | ---------------------------------------- |
+| start | - | 开始播放图片帧动画。再次调用,重新从第1帧开始播放。 |
+| pause | - | 暂停播放图片帧动画。 |
+| stop | - | 停止播放图片帧动画。 |
+| resume | - | 继续播放图片帧。 |
+| getState | - | 获取播放状态。可能值有: - playing:播放中 - paused:已暂停 - stopped:已停止。 |
## 示例
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-slider.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-slider.md
index a686e9cf6202041c883ce347c9feaf34af329572..8851c22fecbb2077f9a9d4e34740e5ee24e237a5 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-slider.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-slider.md
@@ -14,52 +14,52 @@
## 属性
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| min | number | 0 | 否 | 滑动选择器的最小值。 |
-| max | number | 100 | 否 | 滑动选择器的最大值。 |
-| value | number | 0 | 否 | 滑动选择器的初始值。 |
-| id | string | - | 否 | 组件的唯一标识。 |
-| style | string | - | 否 | 组件的样式声明。 |
-| class | string | - | 否 | 组件的样式类,用于引用样式表。 |
-| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| ----- | ------ | ---- | ---- | ---------------------------------------- |
+| min | number | 0 | 否 | 滑动选择器的最小值。 |
+| max | number | 100 | 否 | 滑动选择器的最大值。 |
+| value | number | 0 | 否 | 滑动选择器的初始值。 |
+| id | string | - | 否 | 组件的唯一标识。 |
+| style | string | - | 否 | 组件的样式声明。 |
+| class | string | - | 否 | 组件的样式类,用于引用样式表。 |
+| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 |
## 事件
-| 名称 | 参数 | 描述 |
-| -------- | -------- | -------- |
-| change | ChangeEvent | 选择值发生变化时触发该事件。 |
-| click | - | 点击动作触发该事件。 |
-| longpress | - | 长按动作触发该事件。 |
-| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 |
+| 名称 | 参数 | 描述 |
+| ------------------ | --------------------------------- | -------------- |
+| change | ChangeEvent | 选择值发生变化时触发该事件。 |
+| click | - | 点击动作触发该事件。 |
+| longpress | - | 长按动作触发该事件。 |
+| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 |
- **表2** ChangeEvent
+ **表1** ChangeEvent
-| 属性 | 类型 | 说明 |
-| -------- | -------- | -------- |
+| 属性 | 类型 | 说明 |
+| ---------------------------------------- | ------ | ------------- |
| progress(deprecated5+ ) | string | 当前slider的进度值。 |
-| value5+ | number | 当前slider的进度值。 |
+| value5+ | number | 当前slider的进度值。 |
## 样式
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| color | <color> | \#000000 | 否 | 滑动条的背景颜色。 |
-| selected-color | <color> | \#ffffff | 否 | 滑动条的已选择颜色。 |
-| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。 未设置时组件宽度默认为0。 |
-| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。 未设置时组件高度默认为0。 |
-| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。 该属性可以有1到4个值: - 指定一个值时,该值指定四个边的内边距。 - 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。 - 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。 - 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 |
-| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 |
-| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。 - 只有一个值时,这个值会被指定给全部的四个边。 - 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。 - 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。 - 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 |
-| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 |
-| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 |
-| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 |
-| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 |
-| background-color | <color> | - | 否 | 设置背景颜色。 |
-| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为: - flex:弹性布局。 - none:不渲染此元素。 |
-| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。 - left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。 - top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| ---------------------------------- | ---------------------------------------- | -------- | ---- | ---------------------------------------- |
+| color | <color> | \#000000 | 否 | 滑动条的背景颜色。 |
+| selected-color | <color> | \#ffffff | 否 | 滑动条的已选择颜色。 |
+| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。 未设置时组件宽度默认为0。 |
+| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。 未设置时组件高度默认为0。 |
+| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。 该属性可以有1到4个值: - 指定一个值时,该值指定四个边的内边距。 - 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。 - 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。 - 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 |
+| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 |
+| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。 - 只有一个值时,这个值会被指定给全部的四个边。 - 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。 - 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。 - 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 |
+| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 |
+| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 |
+| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 |
+| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 |
+| background-color | <color> | - | 否 | 设置背景颜色。 |
+| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为: - flex:弹性布局。 - none:不渲染此元素。 |
+| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。 - left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。 - top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 |
## 示例
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-animation.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-animation.md
index 14f9864dd0a2fd63a1ee158668d09b4191b5e626..3074f283e577d4db582ae10094bd006a27b3f6f6 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-animation.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-animation.md
@@ -4,43 +4,44 @@
组件普遍支持的可以在style或css中设置的动态的旋转、平移、缩放效果。
-| 名称 | 类型 | 默认值 | 描述 |
-| -------- | -------- | -------- | -------- |
-| transform | string | - | 详见表1。 |
-| animation-name | string | - | 指定\@keyframes,详见表2。 |
-| animation-delay | <time> | 0 | 定义动画播放的延迟时间。支持的单位为[s(秒)\|ms(毫秒) ],默认单位为ms,格式为:1000ms或1s。 |
-| animation-duration | <time> | 0 | 定义一个动画周期。支持的单位为[s(秒)\|ms(毫秒) ],默认单位为ms,格式为:1000ms或1s。 **说明:** animation-duration 样式必须设置,否则时长为 0,则不会播放动画。 |
-| animation-iteration-count | number \| infinite | 1 | 定义动画播放的次数,默认播放一次,可通过设置为infinite无限次播放。 |
-| animation-timing-function | string | linear | 描述动画执行的速度曲线,用于使动画更为平滑。 可选项有: - linear:表示动画从头到尾的速度都是相同的。 - ease-in:表示动画以低速开始,cubic-bezier(0.42, 0.0, 1.0, 1.0)。 - ease-out:表示动画以低速结束,cubic-bezier(0.0, 0.0, 0.58, 1.0)。 - ease-in-out:表示动画以低速开始和结束,cubic-bezier(0.42, 0.0, 0.58, 1.0)。 |
-| animation-fill-mode | string | none | 指定动画开始和结束的状态: - none:在动画执行之前和之后都不会应用任何样式到目标上。 - forwards:在动画结束后,目标将保留动画结束时的状态(在最后一个关键帧中定义)。 |
+| 名称 | 类型 | 默认值 | 描述 |
+| ------------------------- | ---------------------------------- | ----------- | ---------------------------------------- |
+| transform | string | - | 详见表1。 |
+| animation-name | string | - | 指定\@keyframes,详见表2。 |
+| animation-delay | <time> | 0 | 定义动画播放的延迟时间。支持的单位为[s(秒)\|ms(毫秒) ],默认单位为ms,格式为:1000ms或1s。 |
+| animation-duration | <time> | 0 | 定义一个动画周期。支持的单位为[s(秒)\|ms(毫秒) ],默认单位为ms,格式为:1000ms或1s。 **说明:** animation-duration 样式必须设置,否则时长为 0,则不会播放动画。 |
+| animation-iteration-count | number \| infinite | 1 | 定义动画播放的次数,默认播放一次,可通过设置为infinite无限次播放。 |
+| animation-timing-function | string | linear | 描述动画执行的速度曲线,用于使动画更为平滑。 可选项有: - linear:表示动画从头到尾的速度都是相同的。 - ease-in:表示动画以低速开始,cubic-bezier(0.42, 0.0, 1.0, 1.0)。 - ease-out:表示动画以低速结束,cubic-bezier(0.0, 0.0, 0.58, 1.0)。 - ease-in-out:表示动画以低速开始和结束,cubic-bezier(0.42, 0.0, 0.58, 1.0)。 |
+| animation-fill-mode | string | none | 指定动画开始和结束的状态: - none:在动画执行之前和之后都不会应用任何样式到目标上。 - forwards:在动画结束后,目标将保留动画结束时的状态(在最后一个关键帧中定义)。 |
**表1** transform操作说明
-| 名称 | 类型 | 描述 |
-| -------- | -------- | -------- |
-| translateX | <length> | X轴方向平移动画属性 |
-| translateY | <length> | Y轴方向平移动画属性 |
-| rotate | <deg> \| <rad> | 旋转动画属性 |
+| 名称 | 类型 | 描述 |
+| ---------- | ------------------------------------ | ---------- |
+| translateX | <length> | X轴方向平移动画属性 |
+| translateY | <length> | Y轴方向平移动画属性 |
+| rotate | <deg> \| <rad> | 旋转动画属性 |
> **说明:**
-> 轻量级智能穿戴仅支持原始大小的图片进行旋转。
+>
+> 轻量级智能穿戴仅支持原始大小的图片进行旋转。
**表2** \@keyframes属性说明
-| 名称 | 类型 | 默认值 | 描述 |
-| -------- | -------- | -------- | -------- |
-| background-color | <color> | - | 动画执行后应用到组件上的背景颜色。 |
-| width | <length> | - | 动画执行后应用到组件上的宽度值。 |
-| height | <length> | - | 动画执行后应用到组件上的高度值。 |
-| transform | string | - | 定义应用在组件上的变换类型,见表1。 |
+| 名称 | 类型 | 默认值 | 描述 |
+| ---------------- | -------------- | ---- | ------------------ |
+| background-color | <color> | - | 动画执行后应用到组件上的背景颜色。 |
+| width | <length> | - | 动画执行后应用到组件上的宽度值。 |
+| height | <length> | - | 动画执行后应用到组件上的高度值。 |
+| transform | string | - | 定义应用在组件上的变换类型,见表1。 |
对于不支持起始值或终止值缺省的情况,可以通过from和to显示指定起始和结束。示例:
-```
+```css
@keyframes Go
{
from {
@@ -60,4 +61,5 @@
> **说明:**
-> \@keyframes的from/to不支持动态绑定。
+>
+> \@keyframes的from/to不支持动态绑定。
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md
index 4ee8dd602ae16078380f199a889ca0613b420f37..d46fefbfa93db102c54544774702059415d5465d 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md
@@ -45,8 +45,8 @@
**表1** 媒体逻辑操作符
-| 类型 | 说明 |
-| --------------- | ------------------------------------------------------------ |
+| 类型 | 说明 |
+| --------------- | ---------------------------------------- |
| and | 将多个媒体特征(Media Feature)以“与”的方式连接成一个媒体查询,只有当所有媒体特征都为true,查询条件成立。另外,它还可以将媒体类型和媒体功能结合起来。 例如:screen and (device-type: liteWearable) and (max-height: 454) 表示当设备类型是智能穿戴同时应用的最大高度小于等于454个像素单位时成立。 |
| or9+ | 将多个媒体特征以“或”的方式连接成一个媒体查询,如果存在结果为true的媒体特征,则查询条件成立。 例如:screen and (max-height: 454) or (round-screen:true)表示当应用高度小于等于454个像素单位或者设备屏幕是圆形时,条件成立。 |
@@ -55,18 +55,18 @@
## 媒体特征
-| 类型 | 说明 |
-| ---------------- | ------------------------------------------------------------ |
-| height | 应用页面显示区域的高度。 |
-| min-height | 应用页面显示区域的最小高度。 |
-| max-height | 应用页面显示区域的最大高度。 |
-| width | 应用页面显示区域的宽度。 |
-| min-width | 应用页面显示区域的最小宽度。 |
-| max-width | 应用页面显示区域的最大宽度。 |
+| 类型 | 说明 |
+| ---------------- | ---------------------------------------- |
+| height | 应用页面显示区域的高度。 |
+| min-height | 应用页面显示区域的最小高度。 |
+| max-height | 应用页面显示区域的最大高度。 |
+| width | 应用页面显示区域的宽度。 |
+| min-width | 应用页面显示区域的最小宽度。 |
+| max-width | 应用页面显示区域的最大宽度。 |
| aspect-ratio | 应用页面显示区域的宽度与高度的比值。 例如:aspect-ratio: 1/2 |
| min-aspect-ratio | 应用页面显示区域的宽度与高度的最小比值。 |
| max-aspect-ratio | 应用页面显示区域的宽度与高度的最大比值。 |
-| round-screen | 屏幕类型,圆形屏幕为 true, 非圆形屏幕为 false。 |
+| round-screen | 屏幕类型,圆形屏幕为 true, 非圆形屏幕为 false。 |
## 通用媒体特征示例代码
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-stack.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-stack.md
index 47a0a062124bc9a92c26dc325739f5cb1b0b3812..004144cc167cb520da46b1901a33143e42feff17 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-stack.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-stack.md
@@ -14,42 +14,43 @@
## 属性
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| id | string | - | 否 | 组件的唯一标识。 |
-| style | string | - | 否 | 组件的样式声明。 |
-| class | string | - | 否 | 组件的样式类,用于引用样式表。 |
-| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| ----- | ------ | ---- | ---- | ---------------------------------------- |
+| id | string | - | 否 | 组件的唯一标识。 |
+| style | string | - | 否 | 组件的样式声明。 |
+| class | string | - | 否 | 组件的样式类,用于引用样式表。 |
+| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 |
## 事件
-| 名称 | 参数 | 描述 |
-| -------- | -------- | -------- |
-| click | - | 点击动作触发该事件。 |
-| longpress | - | 长按动作触发该事件。 |
+| 名称 | 参数 | 描述 |
+| ------------------ | --------------------------------- | ----------- |
+| click | - | 点击动作触发该事件。 |
+| longpress | - | 长按动作触发该事件。 |
| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 |
## 样式
-| 名称 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。 未设置时组件宽度默认为0。 |
-| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。 未设置时组件高度默认为0。 |
-| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。 该属性可以有1到4个值: - 指定一个值时,该值指定四个边的内边距。 - 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。 - 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。 - 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 |
-| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 |
-| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。 - 只有一个值时,这个值会被指定给全部的四个边。 - 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。 - 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。 - 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 |
-| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 |
-| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 |
-| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 |
-| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 |
-| background-color | <color> | - | 否 | 设置背景颜色。 |
-| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 |
-| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为: - flex:弹性布局。 - none:不渲染此元素。 |
-| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。 - left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。 - top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 |
-
->  **说明:**
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| ---------------------------------- | ---------------------------------------- | ----- | ---- | ---------------------------------------- |
+| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。 未设置时组件宽度默认为0。 |
+| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。 未设置时组件高度默认为0。 |
+| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。 该属性可以有1到4个值: - 指定一个值时,该值指定四个边的内边距。 - 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。 - 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。 - 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 |
+| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 |
+| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。 - 只有一个值时,这个值会被指定给全部的四个边。 - 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。 - 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。 - 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 |
+| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 |
+| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 |
+| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 |
+| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 |
+| background-color | <color> | - | 否 | 设置背景颜色。 |
+| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 |
+| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为: - flex:弹性布局。 - none:不渲染此元素。 |
+| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。 - left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。 - top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 |
+
+> **说明:**
+>
> 由于绝对定位不支持设置百分比,所以也不支持stack组件的子组件上设置margin。
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-file.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-file.md
index 77b4940269728279a8a07fcbcbfcc17f5f1c19c9..e178236619acfa6baad584b2606ba477407d6f0a 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-file.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-file.md
@@ -5,7 +5,7 @@
JS FA应用的JS模块(entry/src/main/js/module)的典型开发目录结构如下:
- **图2** 目录结构
+ **图1** 目录结构

@@ -28,8 +28,8 @@ JS FA应用的JS模块(entry/src/main/js/module)的典型开发目录结构如
>
> - i18n是开发保留文件夹,不可重命名。
>
->
->- 在使用DevEco Studio进行应用开发时,目录结构中的可选文件夹需要开发者根据实际情况自行创建。
+>
+> - 在使用DevEco Studio进行应用开发时,目录结构中的可选文件夹需要开发者根据实际情况自行创建。
## 文件访问规则
@@ -45,29 +45,30 @@ JS FA应用的JS模块(entry/src/main/js/module)的典型开发目录结构如
- CSS样式文件中通过url()函数创建<url>数据类型,如:url(/common/xxx.png)。
> **说明:**
-> 当代码文件A需要引用代码文件B时:
->
-> - 如果代码文件A和文件B位于同一目录,则代码文件B引用资源文件时可使用相对路径,也可使用绝对路径。
->
-> - 如果代码文件A和文件B位于不同目录,则代码文件B引用资源文件时必须使用绝对路径。因为Webpack打包时,代码文件B的目录会发生变化。
->
->
+>
+> 当代码文件A需要引用代码文件B时:
+>
+> - 如果代码文件A和文件B位于同一目录,则代码文件B引用资源文件时可使用相对路径,也可使用绝对路径。
+>
+> - 如果代码文件A和文件B位于不同目录,则代码文件B引用资源文件时必须使用绝对路径。因为Webpack打包时,代码文件B的目录会发生变化。
+>
+>
## 媒体文件格式
**表1** 支持的图片格式
-| 格式 | 支持版本 | 支持的文件类型 |
-| -------- | -------- | -------- |
-| BMP | API Version 4+ | .bmp |
-| JPEG | API Version 4+ | .jpg |
-| PNG | API Version 4+ | .png |
+| 格式 | 支持版本 | 支持的文件类型 |
+| ---- | ------------------------ | ------- |
+| BMP | API Version 4+ | .bmp |
+| JPEG | API Version 4+ | .jpg |
+| PNG | API Version 4+ | .png |
## 存储目录定义
从API Version 5开始,[image](js-components-basic-image.md)组件支持应用私有目录内的图片资源访问。
-| 目录类型 | 路径前缀 | 访问可见性 | 说明 |
-| ------------ | --------------- | ------------ | --------------------------------------------------- |
+| 目录类型 | 路径前缀 | 访问可见性 | 说明 |
+| ------ | --------------- | ------ | --------------------------- |
| 应用私有目录 | internal://app/ | 仅本应用可见 | 目录随应用卸载删除,路径禁止使用../等方式访问父目录 |
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-file.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-file.md
index 7b6bdf24e68d92376a99174713a0c8350a3f6dd9..9fdaf84e6add071df616c363172374714cbf5f7f 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-file.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-file.md
@@ -14,7 +14,7 @@
-```
+```js
// app.js
export default {
onCreate() {
@@ -28,11 +28,13 @@ export default {
## 应用对象10+
-| 属性 | 类型 | 描述 |
-| ------ | -------- | ------------------------------------------------------------ |
+| 属性 | 类型 | 描述 |
+| ------ | -------- | ---------------------------------------- |
| getApp | Function | 提供getApp()全局方法,可以在页面js文件中获取app.js中暴露的数据对象。 |
-> **说明**:应用对象是全局数据,其在整个应用消亡之前都会一直占用JS内存。尽管应用对象可为不同页面共享数据提供便利,但因为小型设备本身内存比较小,也应谨慎使用。如果过度使用,则容易造成应用在进入复杂page页面时,内存不够而出现异常。
+> **说明**:
+>
+> 应用对象是全局数据,其在整个应用消亡之前都会一直占用JS内存。尽管应用对象可为不同页面共享数据提供便利,但因为小型设备本身内存比较小,也应谨慎使用。如果过度使用,则容易造成应用在进入复杂page页面时,内存不够而出现异常。
示例如下:
@@ -80,4 +82,6 @@ export default {
}
```
-> **说明**:为了应用可在不支持getApp的低版本上正常运行,代码中应进行兼容性处理,即在使用getApp前先判断其是否可用。
\ No newline at end of file
+> **说明**:
+>
+> 为了应用可在不支持getApp的低版本上正常运行,代码中应进行兼容性处理,即在使用getApp前先判断其是否可用。
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-tag.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-tag.md
index 5866a02f7f613be4064058dbb94b82beb06fcd4a..c6347aae68d63c9f6a91de893f03efffaf378264 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-tag.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-tag.md
@@ -4,14 +4,15 @@
js标签中包含了实例名称、页面路由信息。
-| 标签 | 类型 | 默认值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| name | string | default | 是 | 标识JS实例的名字。 |
-| pages | Array | - | 是 | 路由信息,详见“**[pages](#pages)**”。 |
+| 标签 | 类型 | 默认值 | 必填 | 描述 |
+| ----- | ------ | ------- | ---- | ----------------------------- |
+| name | string | default | 是 | 标识JS实例的名字。 |
+| pages | Array | - | 是 | 路由信息,详见“**[pages](#pages)**”。 |
> **说明:**
-> name、pages标签配置需在配置文件中的“js”标签中完成设置。
+>
+> name、pages标签配置需在配置文件中的“js”标签中完成设置。
## pages
@@ -33,10 +34,10 @@ js标签中包含了实例名称、页面路由信息。
> **说明:**
>
->
-> - 应用首页固定为"pages/index/index"。
->
-> - 页面文件名不能使用组件名称,比如:text.hml、button.hml等。
+>
+> - 应用首页固定为"pages/index/index"。
+>
+> - 页面文件名不能使用组件名称,比如:text.hml、button.hml等。
## 示例
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md
index b61f1a17c557b0871ce8caeb2cc85245edbb83af..a86b3316268a24b41e749451dd4a7ec63f9a45d2 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md
@@ -14,16 +14,16 @@ CSS是描述HML页面结构的样式语言。所有组件均存在系统默认
每个页面目录下存在一个与布局hml文件同名的css文件,用来描述该hml页面中组件的样式,决定组件应该如何显示。
1. 内部样式,支持使用style、class属性来控制组件的样式。例如:
-
- ```
+
+ ```html
Hello World
```
-
- ```
+
+ ```css
/* index.css */
.container {
justify-content: center;
@@ -31,16 +31,16 @@ CSS是描述HML页面结构的样式语言。所有组件均存在系统默认
```
2. 文件导入,合并外部样式文件。例如,在common目录中定义样式文件style.css,并在index.css文件首行中进行导入:
-
- ```
+
+ ```css
/* style.css */
.title {
font-size: 50px;
}
```
-
- ```
+
+ ```css
/* index.css */
@import '../../common/style.css';
.container {
@@ -53,16 +53,16 @@ CSS是描述HML页面结构的样式语言。所有组件均存在系统默认
css选择器用于选择需要添加样式的元素,支持的选择器如下表所示:
-| 选择器 | 样例 | 样例描述 |
-| -------- | -------- | -------- |
-| .class | .container | 用于选择class="container"的组件。 |
-| \#id | \#titleId | 用于选择id="titleId"的组件。 |
-| , | .title, .content | 用于选择class="title"和class="content"的组件。 |
+| 选择器 | 样例 | 样例描述 |
+| ------ | --------------------- | ------------------------------------- |
+| .class | .container | 用于选择class="container"的组件。 |
+| \#id | \#titleId | 用于选择id="titleId"的组件。 |
+| , | .title, .content | 用于选择class="title"和class="content"的组件。 |
示例:
-```
+```html
标题
@@ -73,7 +73,7 @@ css选择器用于选择需要添加样式的元素,支持的选择器如下
```
-```
+```css
/* 页面样式xxx.css */
/* 对class="title"的组件设置样式 */
.title {
@@ -97,15 +97,15 @@ css伪类是选择器中的关键字,用于指定要选择元素的特殊状
-| 名称 | 支持组件 | 描述 |
-| -------- | -------- | -------- |
-| :active |
input[type="button"] | 表示被用户激活的元素,如:被用户按下的按钮。轻量级智能穿戴上伪类选择器上仅支持background-color 和background-image 的样式设置。 |
+| 名称 | 支持组件 | 描述 |
+| -------- | ----------------------------------- | ---------------------------------------- |
+| :active |
input[type="button"] | 表示被用户激活的元素,如:被用户按下的按钮。轻量级智能穿戴上伪类选择器上仅支持background-color 和background-image 的样式设置。 |
| :checked | input[type="checkbox"、type="radio"] | 表示checked属性为true的元素。轻量级智能穿戴上伪类选择器上仅支持background-color 和background-image 的样式设置。 |
伪类示例如下,设置按钮的:active伪类可以控制被用户按下时的样式:
-```
+```html
@@ -113,7 +113,7 @@ css伪类是选择器中的关键字,用于指定要选择元素的特殊状
```
-```
+```css
/* index.css */
.button:active {
background-color: #888888;/*按钮被激活时,背景颜色变为#888888 */
@@ -126,8 +126,8 @@ css伪类是选择器中的关键字,用于指定要选择元素的特殊状
预编译提供了利用特有语法生成css的程序,可以提供变量、运算等功能,令开发者更便捷地定义组件样式,目前支持less、sass和scss的预编译。使用样式预编译时,需要将原css文件后缀改为less、sass或scss,如index.css改为index.less、index.sass或index.scss。
- 当前文件使用样式预编译,例如将原index.css改为index.less:
-
- ```
+
+ ```css
/* index.less */
/* 定义变量 */
@colorBackground: #000000;
@@ -137,8 +137,8 @@ css伪类是选择器中的关键字,用于指定要选择元素的特殊状
```
- 引用预编译文件,例如common中存在style.scss文件,将原index.css改为index.scss,并引入style.scss:
-
- ```
+
+ ```css
/* style.scss */
/* 定义变量 */
$colorBackground: #000000;
@@ -146,8 +146,8 @@ css伪类是选择器中的关键字,用于指定要选择元素的特殊状
在index.scss中引用:
-
- ```
+
+ ```css
/* index.scss */
/* 引入外部scss文件 */
@import '../../common/style.scss';
@@ -156,6 +156,7 @@ css伪类是选择器中的关键字,用于指定要选择元素的特殊状
}
```
-
+
> **说明:**
- > 引用的预编译文件建议放在common目录进行管理。
+ >
+ > 引用的预编译文件建议放在common目录进行管理。
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md
index 73ebc3421624f68c271b1bc3718136fc1a4b0556..6950106f73c4681c7cf03ab3640a9d065c67a7e6 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md
@@ -7,7 +7,7 @@ HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组
## 页面结构
-```
+```html
Image Show
@@ -21,7 +21,7 @@ HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组
## 数据绑定
-```
+```html
{{content[1]}}
@@ -29,7 +29,7 @@ HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组
```
-```
+```js
// xxx.js
export default {
data: {
@@ -42,9 +42,9 @@ export default {
```
> **说明:**
-> - 针对数组内的数据修改,请使用splice方法生效数据绑定变更。
->
-> - hml中的js表达式不支持ES6语法。
+> - 针对数组内的数据修改,请使用splice方法生效数据绑定变更。
+>
+> - hml中的js表达式不支持ES6语法。
## 事件绑定
@@ -52,7 +52,7 @@ export default {
事件绑定的回调函数接收一个事件对象参数,可以通过访问该事件对象获取事件信息。
-```
+```html
@@ -73,7 +73,7 @@ export default {
```
-```
+```js
// xxx.js
export default {
data: {
@@ -88,11 +88,11 @@ export default {
> **说明:**
>
-> 事件冒泡机制从API Version 5开始支持。升级SDK后,运行存量JS应用,采用旧写法(onclick)的事件绑定还是按事件不冒泡进行处理。但如果使用新版本SDK重新打包JS应用,将旧写法按事件冒泡进行处理。为了避免业务逻辑错误,建议将旧写法(如onclick)改成新写法(grab:click)。
+> 事件冒泡机制从API Version 5开始支持。升级SDK后,运行存量JS应用,采用旧写法(onclick)的事件绑定还是按事件不冒泡进行处理。但如果使用新版本SDK重新打包JS应用,将旧写法按事件冒泡进行处理。为了避免业务逻辑错误,建议将旧写法(如onclick)改成新写法(grab:click)。
**示例:**
-```
+```html
{{count}}
@@ -108,8 +108,8 @@ export default {
```
-```
-/* xxx.js */
+```js
+// xxx.js
export default {
data: {
count: 0
@@ -127,7 +127,7 @@ export default {
```
-```
+```css
/* xxx.css */
.container {
display: flex;
@@ -164,7 +164,7 @@ export default {
## 列表渲染
-```
+```html
@@ -184,7 +184,7 @@ export default {
```
-```
+```js
// xxx.js
export default {
data: {
@@ -211,11 +211,12 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
- for="(i, v) in array":其中元素索引为i,元素变量为v,遍历数组对象array。
->  **说明:**
+> **说明:**
+>
> - 数组中的每个元素必须存在tid指定的数据属性,否则运行时可能会导致异常。
->
+>
> - 数组中被tid指定的属性要保证唯一性,如果不是则会造成性能损耗。比如,示例中只有id和name可以作为tid字段,因为它们属于唯一字段。
->
+>
> - tid不支持表达式。
@@ -224,7 +225,7 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
条件渲染分为2种:if/elif/else和show。两种写法的区别在于:第一种写法里if为false时,组件不会在vdom中构建,也不会渲染,而第二种写法里show为false时虽然也不渲染,但会在vdom中构建;另外,当使用if/elif/else写法时,节点必须是兄弟节点,否则编译无法通过。实例如下:
-```
+```html
@@ -236,8 +237,8 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
```
-```
-// xxx.css
+```css
+/* xxx.css */
.container{
flex-direction: column;
align-items: center;
@@ -250,7 +251,7 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
```
-```
+```js
// xxx.js
export default {
data: {
@@ -269,7 +270,7 @@ export default {
优化渲染优化:show方法。当show为真时,节点正常渲染;当为假时,仅仅设置display样式为none。
-```
+```html
@@ -278,8 +279,8 @@ export default {
```
-```
-// xxx.css
+```css
+/* xxx.css */
.container{
flex-direction: column;
align-items: center;
@@ -292,7 +293,7 @@ export default {
```
-```
+```js
// xxx.js
export default {
data: {
@@ -305,4 +306,5 @@ export default {
```
> **说明:**
-> 禁止在同一个元素上同时设置for和if属性。
+>
+> 禁止在同一个元素上同时设置for和if属性。
diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md
index 1a9c10683d0a75f0aab1997e49ada59b84a664c4..19823d44ee74a86b286e439aedafade9001a089e 100644
--- a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md
+++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md
@@ -31,7 +31,7 @@ JS文件用来定义HML页面的业务逻辑,支持ECMA规范的JavaScript语
- 模块声明
使用import方法引入功能模块:
-
+
```
import router from '@system.router';
```
@@ -39,7 +39,7 @@ JS文件用来定义HML页面的业务逻辑,支持ECMA规范的JavaScript语
- 代码引用
使用import方法导入js代码:
-
+
```
import utils from '../../common/utils.js';
```
@@ -48,25 +48,25 @@ JS文件用来定义HML页面的业务逻辑,支持ECMA规范的JavaScript语
## 对象
- 页面对象
- | 属性 | 类型 | 描述 |
- | -------- | -------- | -------- |
- | data | Object/Function | 页面的数据模型,类型是对象或者函数,如果类型是函数,返回值必须是对象。属性名不能以$或_开头,不要使用保留字for, if, show, tid。
|
- | $refs | Object | 持有注册过ref 属性的DOM元素或子组件实例的对象。示例见[获取DOM元素](#获取dom元素)。 |
+ | 属性 | 类型 | 描述 |
+ | ----- | --------------- | ---------------------------------------- |
+ | data | Object/Function | 页面的数据模型,类型是对象或者函数,如果类型是函数,返回值必须是对象。属性名不能以$或_开头,不要使用保留字for, if, show, tid。
|
+ | $refs | Object | 持有注册过ref 属性的DOM元素或子组件实例的对象。示例见[获取DOM元素](#获取dom元素)。 |
## 获取DOM元素
1. 通过$refs获取DOM元素
-
- ```
+
+ ```html
```
-
- ```
+
+ ```js
// index.js
export default {
data: {
@@ -94,29 +94,29 @@ JS文件用来定义HML页面的业务逻辑,支持ECMA规范的JavaScript语
## 生命周期接口
- 页面生命周期
- | 属性 | 类型 | 参数 | 返回值 | 描述 | 触发时机 |
- | -------- | -------- | -------- | -------- | -------- | -------- |
- | onInit | Function | 无 | 无 | 页面初始化 | 页面数据初始化完成时触发,只触发一次。 |
- | onReady | Function | 无 | 无 | 页面创建完成 | 页面创建完成时触发,只触发一次。 |
- | onShow | Function | 无 | 无 | 页面显示 | 页面显示时触发。 |
- | onHide | Function | 无 | 无 | 页面消失 | 页面消失时触发。 |
- | onDestroy | Function | 无 | 无 | 页面销毁 | 页面销毁时触发。 |
-
+ | 属性 | 类型 | 参数 | 返回值 | 描述 | 触发时机 |
+ | --------- | -------- | ---- | ---- | ------ | ------------------- |
+ | onInit | Function | 无 | 无 | 页面初始化 | 页面数据初始化完成时触发,只触发一次。 |
+ | onReady | Function | 无 | 无 | 页面创建完成 | 页面创建完成时触发,只触发一次。 |
+ | onShow | Function | 无 | 无 | 页面显示 | 页面显示时触发。 |
+ | onHide | Function | 无 | 无 | 页面消失 | 页面消失时触发。 |
+ | onDestroy | Function | 无 | 无 | 页面销毁 | 页面销毁时触发。 |
+
页面A的生命周期接口的调用顺序:
- 打开页面A:onInit() -> onReady() -> onShow()
-
+
- 在页面A打开页面B:onHide() -> onDestroy()
-
+
- 从页面B返回页面A:onInit() -> onReady() -> onShow()
-
+
- 退出页面A:onHide() -> onDestroy()
-
+
- 页面隐藏到后台运行:onHide()
-
+
- 页面从后台运行恢复到前台:onShow()
- 应用生命周期
- | 属性 | 类型 | 参数 | 返回值 | 描述 | 触发时机 |
- | -------- | -------- | -------- | -------- | -------- | -------- |
- | onCreate | Function | 无 | 无 | 应用创建 | 当应用创建时调用。 |
- | onDestroy | Function | 无 | 无 | 应用退出 | 当应用退出时触发。 |
+ | 属性 | 类型 | 参数 | 返回值 | 描述 | 触发时机 |
+ | --------- | -------- | ---- | ---- | ---- | --------- |
+ | onCreate | Function | 无 | 无 | 应用创建 | 当应用创建时调用。 |
+ | onDestroy | Function | 无 | 无 | 应用退出 | 当应用退出时触发。 |
diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md b/zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md
index 80e1fced38bfce12740fe9c04130e9748aeaf8dc..70a811bde54a71cefae8a5d054df2437a9a76ce2 100644
--- a/zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md
+++ b/zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md
@@ -1,6 +1,7 @@
# CanvasRenderingContext2D对象
> **说明:**
+>
> 从API version 4开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
使用CanvasRenderingContext2D在canvas画布组件上进行绘制,绘制对象可以是矩形、文本、图片等。
@@ -862,10 +863,10 @@ moveTo(x: number, y: number): void
**参数:**
-| 参数 | 类型 | 描述 |
-| ---- | ------ | --------- |
-| x | number | 指定位置的x坐标。 |
-| y | number | 指定位置的y坐标。 |
+| 参数 | 类型 | 描述 |
+| ---- | ------ | ------------------ |
+| x | number | 指定位置的x坐标。
单位:vp |
+| y | number | 指定位置的y坐标。
单位:vp |
**示例:**
```html
@@ -901,8 +902,8 @@ lineTo(x: number, y: number): void
| 参数 | 类型 | 描述 |
| ---- | ------ | --------- |
-| x | number | 指定位置的x坐标。 |
-| y | number | 指定位置的y坐标。 |
+| x | number | 指定位置的x坐标。
单位:vp |
+| y | number | 指定位置的y坐标。
单位:vp |
**示例:**
```html
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md
index cef06a564344b5ffcfc048118573515863bd3b65..6c5ead5cf5e509e0d526e3b37ec251a965574c19 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md
@@ -30,7 +30,7 @@ Checkbox(options?: {name?: string, group?: string })
| 名称 | 参数类型 | 描述 |
| ------------- | ------- | -------- |
-| select | boolean | 设置多选框是否选中。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 |
+| select | boolean | 设置多选框是否选中。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。
从API version 10开始,该属性支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置多选框选中状态颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 |
| unselectedColor
10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置多选框非选中状态边框颜色。 |
| mark
10+ | [MarkStyle](#markstyle10对象说明) | 多选框内部图标样式。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md
index 37c1566db5089c7ea39ca4c04fc84cb0149b1aed..b2d5513fc77b2718136411933be37f2b098053d2 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md
@@ -30,7 +30,7 @@ CheckboxGroup(options?: { group?: string })
| 名称 | 参数类型 | 描述 |
| -------- | -------- | -------- |
-| selectAll | boolean | 设置是否全选。
默认值:false,若同组的[Checkbox](ts-basic-components-checkbox.md)设置了select属性,则Checkbox的优先级高。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
若同组的[Checkbox](ts-basic-components-checkbox.md)显式设置了select属性,则Checkbox的优先级高。 |
+| selectAll | boolean | 设置是否全选。
默认值:false,若同组的[Checkbox](ts-basic-components-checkbox.md)设置了select属性,则Checkbox的优先级高。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
若同组的[Checkbox](ts-basic-components-checkbox.md)显式设置了select属性,则Checkbox的优先级高。
从API version 10开始,该属性支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置被选中或部分选中状态的颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 |
| unselectedColor
10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置非选中状态边框颜色。 |
| mark
10+ | [MarkStyle](#markstyle10对象说明) | 多选框内部图标样式。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md
index d21ed937c49f9d90109c24aca11514a46424fb4a..c6405174c194a2e4f0fd89b68ce5a75d6b8b5cae 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md
@@ -20,11 +20,11 @@ DatePicker(options?: {start?: Date, end?: Date, selected?: Date})
**参数:**
-| 参数名 | 参数类型 | 必填 | 参数描述 |
-| -------- | ---- | ---- | -------------------------------------- |
-| start | Date | 否 | 指定选择器的起始日期。
默认值:Date('1970-1-1') |
-| end | Date | 否 | 指定选择器的结束日期。
默认值:Date('2100-12-31') |
-| selected | Date | 否 | 设置选中项的日期。
默认值:当前系统日期 |
+| 参数名 | 参数类型 | 必填 | 参数描述 |
+| -------- | -------- | ---- | ------------------------------------------------------------ |
+| start | Date | 否 | 指定选择器的起始日期。
默认值:Date('1970-1-1') |
+| end | Date | 否 | 指定选择器的结束日期。
默认值:Date('2100-12-31') |
+| selected | Date | 否 | 设置选中项的日期。
默认值:当前系统日期
从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
## 属性
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md
index baca369fe5b425e76e7471285da48a55dbf3a4f7..3845f446b6f003dfbec0ac408da03e759a4b1b04 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md
@@ -36,7 +36,7 @@ MenuItem(value?: MenuItemOptions| CustomBuilder)
| 名称 | 参数类型 | 描述 |
| ------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
-| selected | boolean | 设置菜单项是否选中。
默认值:false |
+| selected | boolean | 设置菜单项是否选中。
默认值:false
从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| selectIcon | boolean \| [ResourceStr](ts-types.md#resourcestr)
10+ | 当菜单项被选中时,是否显示被选中的图标。
默认值:false
true: 菜单项被选中时,显示默认的对勾图标
false: 即使菜单项被选中也不显示图标
ResourceStr: 菜单项被选中时,显示指定的图标 |
| contentFont
10+ | [Font](ts-types.md#font) | 设置菜单项中内容信息的字体样式。 |
| contentFontColor
10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置菜单项中内容信息的字体颜色。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md
index b9438839f0e0d154be97d214fa97d63ce5a29107..b0be410a5a3745df222174e29c53923ab8b8623d 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md
@@ -31,7 +31,7 @@ Radio(options: {value: string, group: string})
| 名称 | 参数类型 | 描述 |
| -------- | -------- | -------- |
-| checked | boolean | 设置单选框的选中状态。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 |
+| checked | boolean | 设置单选框的选中状态。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。
从API version 10开始,该属性支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| radioStyle
10+ | [RadioStyle](#radiostyle对象说明) | 设置单选框选中状态和非选中状态的样式。
从API version 10开始,该接口支持在ArkTS组件中使用。|
## 事件
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md
index b137ec163412bcc8686b12f1bcf6129d2dff5797..089c0d5798917c17966d61da4487da1cd2bb6a7d 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md
@@ -20,10 +20,10 @@ Rating(options?: { rating: number, indicator?: boolean })
**参数:**
-| 参数名 | 参数类型 | 必填 | 参数描述 |
-| --------- | ------- | ---- | ---------------------------------------- |
-| rating | number | 是 | 设置并接收评分值。
默认值:0
取值范围: [0, stars]
小于0取0,大于stars取最大值stars。 |
-| indicator | boolean | 否 | 设置评分组件作为指示器使用,不可改变评分。
默认值:false, 可进行评分
**说明:**
indicator=true时,默认组件高度height=12.0vp,组件width=height*stars。
indicator=false时,默认组件高度height=28.0vp,组件width=height*stars。 |
+| 参数名 | 参数类型 | 必填 | 参数描述 |
+| --------- | -------- | ---- | ------------------------------------------------------------ |
+| rating | number | 是 | 设置并接收评分值。
默认值:0
取值范围: [0, stars]
小于0取0,大于stars取最大值stars。
从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
+| indicator | boolean | 否 | 设置评分组件作为指示器使用,不可改变评分。
默认值:false, 可进行评分
**说明:**
indicator=true时,默认组件高度height=12.0vp,组件width=height*stars。
indicator=false时,默认组件高度height=28.0vp,组件width=height*stars。 |
## 属性
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-search.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-search.md
index dd76a0865b425870c421c03431297b5ca322849c..d963978b349fdf7a2891edc57052a4854c180447 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-search.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-search.md
@@ -18,7 +18,7 @@ Search(options?: { value?: string; placeholder?: ResourceStr; icon?: string; con
| 参数名 | 参数类型 | 必填 | 参数描述 |
| ----------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
-| value | string | 否 | 设置当前显示的搜索文本内容。 |
+| value | string | 否 | 设置当前显示的搜索文本内容。
从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| placeholder | [ResourceStr](ts-types.md#resourcestr)
10+ | 否 | 设置无输入时的提示文本。 |
| icon | string | 否 | 设置搜索图标路径,默认使用系统搜索图标。
图标所支持的图片类型能力参考[Image](ts-basic-components-image.md)组件。 |
| controller | SearchController | 否 | 设置Search组件控制器。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md
index d1a5a97d999faa05df7d5ab6c97a22d46b4b67c6..095249317f1d1fd9a628e60f677b55ad1b5b0282 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md
@@ -27,8 +27,8 @@ Select(options: Array\<[SelectOption](#selectoption对象说明)\>)
| 名称 | 参数类型 | 描述 |
| ----------------------- | ------------------------------------- | --------------------------------------------- |
-| selected | number | 设置下拉菜单初始选项的索引,第一项的索引为0。
当不设置selected属性时,默认选择值为-1,菜单项不选中。 |
-| value | string | 设置下拉按钮本身的文本内容。当菜单选中时默认会替换为菜单项文本内容。 |
+| selected | number | 设置下拉菜单初始选项的索引,第一项的索引为0。
当不设置selected属性时,默认选择值为-1,菜单项不选中。
从API version 10开始,该属性支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
+| value | string | 设置下拉按钮本身的文本内容。当菜单选中时默认会替换为菜单项文本内容。
从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| font | [Font](ts-types.md#font) | 设置下拉按钮本身的文本样式。
默认值:
{
size: '16fp',
weight: FontWeight.Medium
} |
| fontColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉按钮本身的文本颜色。
默认值:'\#E6FFFFFF' |
| selectedOptionBgColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉菜单选中项的背景色。
默认值:'\#33007DFF' |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md
index 5339b622857b7c00c7aed5094a491901416d493d..767fa75b68562584234f23d0a365f106d5e6aae3 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md
@@ -22,7 +22,7 @@ Slider(options?: {value?: number, min?: number, max?: number, step?: number, sty
| 参数名 | 参数类型 | 必填 | 参数描述 |
| -------- | -------- | -------- | -------- |
-| value | number | 否 | 当前进度值。
默认值:0 |
+| value | number | 否 | 当前进度值。
默认值:0
从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| min | number | 否 | 设置最小值。
默认值:0 |
| max | number | 否 | 设置最大值。
默认值:100
**说明:**
min >= max异常情况,min取默认值0,max取默认值100。
value不在[min, max]范围之内,取min/max,靠近min取min,靠近max取max。 |
| step | number | 否 | 设置Slider滑动步长。
默认值:1
取值范围:[0.01, max]
**说明:**
设置小于0或百分比的值时,按默认值显示。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-stepper.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-stepper.md
index 5d75e95d46cf426c88e71511beb0ff61e63bed42..664f7f6b2c0cdab96991ca4d717c94a91169607a 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-stepper.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-stepper.md
@@ -22,7 +22,7 @@ Stepper(value?: { index?: number })
| 参数名 | 参数类型 | 必填 | 参数描述 |
| ------| -------- | --------------- | -------- |
-| index | number | 否 | 设置步骤导航器当前显示StepperItem的索引值。
默认值:0 |
+| index | number | 否 | 设置步骤导航器当前显示StepperItem的索引值。
默认值:0
从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
## 属性
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md
index f9d875ecc81448a2e8ad0a29515bd32b8bda55d4..91e7fb0caa0042686270389a8588def380b18d9d 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md
@@ -21,7 +21,7 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex
| 参数名 | 参数类型 | 必填 | 参数描述 |
| ----------------------- | ---------------------------------------- | ---- | -------------- |
| placeholder | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置无输入时的提示文本。输入内容后,提示文本不显示。 |
-| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。当组件设置[stateStyles](ts-universal-attributes-polymorphic-style.md)等刷新属性时,建议通过onChange事件将状态变量与文本实时绑定,避免组件刷新时TextArea中的文本内容异常。 |
+| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。当组件设置[stateStyles](ts-universal-attributes-polymorphic-style.md)等刷新属性时,建议通过onChange事件将状态变量与文本实时绑定,避免组件刷新时TextArea中的文本内容异常。
从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| controller
8+ | [TextAreaController](#textareacontroller8) | 否 | 设置TextArea控制器。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md
index 18078cdd83a821c791a67dcbadabe299d08dc693..f389bd0adc81576ba9abebfc79137c182f8d9c4e 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md
@@ -21,7 +21,7 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te
| 参数名 | 参数类型 | 必填 | 参数描述 |
| ----------------------- | ---------------------------------------- | ---- | --------------- |
| placeholder | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置无输入时的提示文本。 |
-| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。当组件设置[stateStyles](ts-universal-attributes-polymorphic-style.md)等刷新属性时,建议通过onChange事件将状态变量与文本实时绑定,避免组件刷新时TextInput中的文本内容异常。 |
+| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。当组件设置[stateStyles](ts-universal-attributes-polymorphic-style.md)等刷新属性时,建议通过onChange事件将状态变量与文本实时绑定,避免组件刷新时TextInput中的文本内容异常。
从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| controller
8+ | [TextInputController](#textinputcontroller8) | 否 | 设置TextInput控制器。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md
index 6e0725e30db7e747778055b03d69f113e1030b32..d472725ac4eaedb592d8fa813d5715b884b1b87a 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md
@@ -20,9 +20,9 @@ TimePicker(options?: {selected?: Date})
**参数:**
-| 参数名 | 参数类型 | 必填 | 参数描述 |
-| -------- | ---- | ---- | ------------------------ |
-| selected | Date | 否 | 设置选中项的时间。
默认值:当前系统时间 |
+| 参数名 | 参数类型 | 必填 | 参数描述 |
+| -------- | -------- | ---- | ------------------------------------------------------------ |
+| selected | Date | 否 | 设置选中项的时间。
默认值:当前系统时间
从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
## 属性
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md
index 949cd14f77d1311bc4b4bbc10c8e8a16baabe02d..059d6c39d2de6d98ae35d87727059df6abd3d325 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md
@@ -22,7 +22,7 @@ Toggle(options: { type: ToggleType, isOn?: boolean })
| 参数名 | 参数类型 | 必填 | 参数描述 |
| ---- | ---------- | -----| -------------- |
| type | [ToggleType](#toggletype枚举说明) | 是 | 开关的样式。 |
-| isOn | boolean | 否 | 开关是否打开,true:打开,false:关闭。
默认值:false |
+| isOn | boolean | 否 | 开关是否打开,true:打开,false:关闭。
默认值:false
从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
## ToggleType枚举说明
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md
index 1a97eda35fc0f2b9f4b9170fee8b1890ae58b8df..fcfc566a0264c30f8ce11201ba876738fe8917eb 100755
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md
@@ -28,7 +28,7 @@ Web(options: { src: ResourceStr, controller: WebviewController | WebController})
| 参数名 | 参数类型 | 必填 | 参数描述 |
| ---------- | ---------------------------------------- | ---- | ------- |
| src | [ResourceStr](ts-types.md) | 是 | 网页资源地址。如果访问本地资源文件,请使用$rawfile或者resource协议。如果加载应用包外沙箱路径的本地资源文件,请使用file://沙箱文件路径。 |
-| controller | [WebviewController
9+ ](../apis/js-apis-webview.md#webviewcontroller) \| [WebController](#webcontroller) | 是 | 控制器。从API Version 9开始,WebController不在维护,建议使用WebviewController替代。 |
+| controller | [WebviewController
9+ ](../apis/js-apis-webview.md#webviewcontroller) \| [WebController](#webcontroller) | 是 | 控制器。从API Version 9开始,WebController不再维护,建议使用WebviewController替代。 |
**示例:**
@@ -241,7 +241,7 @@ javaScriptProxy(javaScriptProxy: { object: object, name: string, methodList: Arr
| object | object | 是 | - | 参与注册的对象。只能声明方法,不能声明属性。 |
| name | string | 是 | - | 注册对象的名称,与window中调用的对象名一致。 |
| methodList | Array\
| 是 | - | 参与注册的应用侧JavaScript对象的方法。 |
-| controller | [WebviewController9+ ](../apis/js-apis-webview.md#webviewcontroller) \| [WebController](#webcontroller) | 是 | - | 控制器。从API Version 9开始,WebController不在维护,建议使用WebviewController替代。 |
+| controller | [WebviewController9+ ](../apis/js-apis-webview.md#webviewcontroller) \| [WebController](#webcontroller) | 是 | - | 控制器。从API Version 9开始,WebController再维护,建议使用WebviewController替代。 |
**示例:**
@@ -2248,7 +2248,7 @@ onScaleChange(callback: (event: {oldScale: number, newScale: number}) => void)
onUrlLoadIntercept(callback: (event?: { data:string | WebResourceRequest }) => boolean)
当Web组件加载url之前触发该回调,用于判断是否阻止此次访问。默认允许加载。
-从API version 10开始不在维护,建议使用[onLoadIntercept10+ ](#onloadintercept10)代替。
+从API version 10开始再维护,建议使用[onLoadIntercept10+ ](#onloadintercept10)代替。
**参数:**
@@ -3668,7 +3668,7 @@ getResponseMimeType(): string
### setResponseData9+
-setResponseData(data: string | number)
+setResponseData(data: string | number \| Resource)
设置资源响应数据。
@@ -3676,7 +3676,7 @@ setResponseData(data: string | number)
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ------ | ---------------- | ---- | ------ | ------------------------------------------------------------ |
-| data | string \| number | 是 | - | 要设置的资源响应数据。string表示输入类型是字符串,number表示输入类型是文件句柄。 |
+| data | string \| number \| [Resource](ts-types.md)10+ | 是 | - | 要设置的资源响应数据。string表示HTML格式的字符串。number表示文件句柄, 此句柄由系统的Web组件负责关闭。 Resource表示应用rawfile目录下文件资源。|
### setResponseEncoding9+
@@ -5078,7 +5078,7 @@ clearHistory(): void
setCookie(url: string, value: string): boolean
设置cookie,该方法为同步方法。设置成功返回true,否则返回false。
-从API version 9开始不在维护,建议使用[setCookie9+ ](../apis/js-apis-webview.md#setcookie)代替。
+从API version 9开始不再维护,建议使用[setCookie9+ ](../apis/js-apis-webview.md#setcookie)代替。
**参数:**
@@ -5118,7 +5118,7 @@ setCookie(url: string, value: string): boolean
saveCookie(): boolean
将当前存在内存中的cookie同步到磁盘中,该方法为同步方法。
-从API version 9开始不在维护,建议使用[saveCookieAsync9+ ](../apis/js-apis-webview.md#savecookieasync)代替。
+从API version 9开始不再维护,建议使用[saveCookieAsync9+ ](../apis/js-apis-webview.md#savecookieasync)代替。
**返回值:**
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md
index 84eab79ac1de7d932babff111b590b91df8d0598..843d0ce55f52eba5bceb1061f0fb550c8f18ee62 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md
@@ -21,7 +21,7 @@ AlphabetIndexer(value: {arrayValue: Array<string>, selected: number})
| 参数名 | 参数类型 | 必填 | 参数描述 |
| -------- | -------- | -------- | -------- |
| arrayValue | Array<string> | 是 | 字母索引字符串数组,不可设置为空。 |
-| selected | number | 是 | 初始选中项索引值,若超出索引值范围,则取默认值0。 |
+| selected | number | 是 | 初始选中项索引值,若超出索引值范围,则取默认值0。 从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
## 属性
@@ -40,7 +40,7 @@ AlphabetIndexer(value: {arrayValue: Array<string>, selected: number})
| font | [Font](ts-types.md#font) | 设置字母索引条默认字体样式。 默认值: { size:10, style:FontStyle.Normal, weight:FontWeight.Normal, family:'HarmonyOS Sans' } |
| itemSize | string \| number | 设置字母索引条字母区域大小,字母区域为正方形,即正方形边长。不支持设置为百分比。 默认值:24.0 单位:vp |
| alignStyle | value: [IndexerAlign](#indexeralign枚举说明), offset10+ ?: [Length](ts-types.md#length) | value:设置字母索引条弹框的对齐样式,支持弹窗显示在索引条右侧和左侧。 默认值: IndexerAlign.Right。 offset:设置提示弹窗与索引条之间间距,大于等于0为有效值,在不设置或设置为小于0的情况下间距与popupPosition.x相同。 |
-| selected | number | 设置选中项索引值。 默认值:0。 |
+| selected | number | 设置选中项索引值。 默认值:0。 从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| popupPosition | [Position](ts-types.md#position8) | 设置弹出窗口相对于索引器条上边框中点的位置。 默认值:{x:96.0, y:48.0}。 |
| popupSelectedColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置提示弹窗非字母部分选中文字色。 默认值:#FF182431 |
| popupUnselectedColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置提示弹窗非字母部分未选中文字色。 默认值:#FF182431 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md
index 5cb298df0918c9bb4539d4215027063b86acd417..2131707f534311d0e7c2344df367e2595cad584e 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md
@@ -33,7 +33,7 @@ Panel(show: boolean)
| 名称 | 参数类型 | 描述 |
| -------- | -------- | -------- |
| type | [PanelType](#paneltype枚举说明) | 设置可滑动面板的类型。 默认值:PanelType.Foldable |
-| mode | [PanelMode](#panelmode枚举说明) | 设置可滑动面板的初始状态。 Minibar类型默认值:PanelMode.Mini;其余类型默认值:PanelMode.Half |
+| mode | [PanelMode](#panelmode枚举说明) | 设置可滑动面板的初始状态。 Minibar类型默认值:PanelMode.Mini;其余类型默认值:PanelMode.Half 从API version 10开始,该属性支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| dragBar | boolean | 设置是否存在dragbar,true表示存在,false表示不存在。 默认值:true |
| fullHeight | string \| number | 指定PanelMode.Full状态下的高度。 默认值:当前组件主轴大小减去8vp空白区 **说明:** 不支持设置百分比。 |
| halfHeight | string \| number | 指定PanelMode.Half状态下的高度。 默认值:当前组件主轴大小的一半。 **说明:** 不支持设置百分比。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md
index 020b18250a8e110f962a5ebaff367aa640378e90..62e79068e9d4d36e46c277ef6f5d4956d5722716 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md
@@ -31,9 +31,9 @@ Scroll(scroller?: Scroller)
| 名称 | 参数类型 | 描述 |
| -------------- | ---------------------------------------- | --------- |
| scrollable | [ScrollDirection](#scrolldirection枚举说明) | 设置滚动方向。 默认值:ScrollDirection.Vertical |
-| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。 默认值:BarState.Auto **说明:** 如果容器组件无法滚动,则滚动条不显示。 |
+| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。 默认值:BarState.Auto **说明:** 如果容器组件无法滚动,则滚动条不显示。如果容器组件的子组件大小为无穷大,则滚动条不支持拖动和伴随滚动。 |
| scrollBarColor | string \| number \| [Color](ts-appendix-enums.md#color) | 设置滚动条的颜色。 |
-| scrollBarWidth | string \| number | 设置滚动条的宽度,不支持百分比设置。 默认值:4 单位:vp |
+| scrollBarWidth | string \| number | 设置滚动条的宽度,不支持百分比设置。 默认值:4 单位:vp **说明:** 如果滚动条的宽度超过其高度,则滚动条的宽度会变为默认值。 |
| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 设置滑动效果,目前支持的滑动效果参见EdgeEffect的枚举说明。 默认值:EdgeEffect.None |
## ScrollDirection枚举说明
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md
index dbb2e0c3d4050531c52b1070d1671b3a3b09a41f..e60e94a82d5f1560ea01ce7e5cf63da05904ada7 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md
@@ -41,7 +41,7 @@ SideBarContainer( type?: SideBarContainerType )
| 名称 | 参数类型 | 描述 |
| -------- | -------- | -------- |
-| showSideBar | boolean | 设置是否显示侧边栏。 默认值:true |
+| showSideBar | boolean | 设置是否显示侧边栏。 默认值:true 从API version 10开始,该属性支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| controlButton | [ButtonStyle](#buttonstyle对象说明) | 设置侧边栏控制按钮的属性。 |
| showControlButton | boolean | 设置是否显示控制按钮。 默认值:true |
| sideBarWidth | number \| [Length](ts-types.md#length)9+ | 设置侧边栏的宽度。 默认值:200 单位:vp **说明:** 设置为小于0的值时按默认值显示。 受最小宽度和最大宽度限制,不在限制区域内取最近的点。 sideBarWidth优先于侧边栏子组件width,sideBarWidth未设置时默认值优先级低于侧边栏子组件width。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md
index 786aef9a2fbdd4c02a31cf3d1eb8cbcf8bd2fa27..418859eeb93e16d907ac35a1d4e1d69aeed75b4c 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md
@@ -33,7 +33,7 @@ Swiper(controller?: SwiperController)
| 名称 | 参数类型 | 描述 |
| --------------------------- | ---------------------------------------- | ---------------------------------------- |
-| index | number | 设置当前在容器中显示的子组件的索引值。 默认值:0 **说明:** 设置小于0或大于等于子组件数量时,按照默认值0处理。 |
+| index | number | 设置当前在容器中显示的子组件的索引值。 默认值:0 **说明:** 设置小于0或大于等于子组件数量时,按照默认值0处理。 从API version 10开始,该属性支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
| autoPlay | boolean | 子组件是否自动播放。 默认值:false **说明:** loop为false时,自动轮播到最后一页时停止轮播。手势切换后不是最后一页时继续播放。 |
| interval | number | 使用自动播放时播放的时间间隔,单位为毫秒。 默认值:3000 |
| indicator10+ | [DotIndicator](#dotindicator) \| [DigitIndicator](#digitindicator) \| boolean | 设置可选导航点指示器样式。 \- DotIndicator:圆点指示器样式。 \- DigitIndicator:数字指示器样式。 \- boolean:是否启用导航点指示器。 默认值:true 默认类型:DotIndicator |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md
index 9319bb050d04b4d33e444a10e0cefe5ec8bf0e7b..04cc1ad48cf426210993e10d55a6fb19409426fa 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md
@@ -18,11 +18,11 @@ Tabs(value?: {barPosition?: BarPosition, index?: number, controller?: [TabsContr
**参数:**
-| 参数名 | 参数类型 | 必填 | 参数描述 |
-| ----------- | --------------------------------- | ---- | ---------------------------------------- |
-| barPosition | BarPosition | 否 | 设置Tabs的页签位置。 默认值:BarPosition.Start |
-| index | number | 否 | 设置初始页签索引。 默认值:0 **说明:** 设置为小于0的值时按默认值显示。 可选值为[0, TabContent子节点数量-1]。 设置不同值时,默认生效切换动效,可以设置animationDuration为0关闭动画。 |
-| controller | [TabsController](#tabscontroller) | 否 | 设置Tabs控制器。 |
+| 参数名 | 参数类型 | 必填 | 参数描述 |
+| ----------- | --------------------------------- | ---- | ------------------------------------------------------------ |
+| barPosition | BarPosition | 否 | 设置Tabs的页签位置。 默认值:BarPosition.Start |
+| index | number | 否 | 设置初始页签索引。 默认值:0 **说明:** 设置为小于0的值时按默认值显示。 可选值为[0, TabContent子节点数量-1]。 设置不同值时,默认生效切换动效,可以设置animationDuration为0关闭动画。 从API version 10开始,该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 |
+| controller | [TabsController](#tabscontroller) | 否 | 设置Tabs控制器。 |
## BarPosition枚举说明
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md b/zh-cn/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md
index 477a9ca18f97c53922be2e37237be1577280a582..b668d1eeeb84c2060e21e669b5ef53e8fe717bde 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md
@@ -43,7 +43,7 @@ onPageHide?(): void
onBackPress?(): void
-当用户点击返回按钮时触发,仅\@Entry装饰的自定义组件生效。返回true表示页面自己处理返回逻辑,不进行页面路由,返回false表示使用默认的路由返回逻辑。不设置返回值按照false处理。
+当用户点击返回按钮时触发,仅\@Entry装饰的自定义组件生效。
```ts
diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md b/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md
index 8c9fe8e825167e257685d1b2226b00a4a76019c6..f8b4cc4e0b0953f89ae21bc455659849e33eefed 100644
--- a/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md
+++ b/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md
@@ -546,7 +546,7 @@ The specified bundle is a shared bundle which cannot be uninstalled.
## 17700044 安装包设置的多进程配置项与系统配置项设置矛盾
**错误信息**
-Failed to install because the isolationMode does not match the system.
+Failed to install the HAP because the isolationMode configured is not supported.
**错误描述**
安装应用时,设置的isolationMode与系统配置项所允许的系统配置项矛盾。
diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md b/zh-cn/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md
index 8da20d94a83b74fdfa869de87ec68d8b27708dac..eb67bae3c5e047017cad5fc8a590baed7871b1be 100644
--- a/zh-cn/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md
+++ b/zh-cn/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md
@@ -58,23 +58,23 @@ Input method client error.
重新将输入法应用与三方应用进行绑定:将三方应用后台进程杀死,重新启动三方应用,通过点击对话框等方式触发输入法键盘的显示,若键盘正常显示,则问题解决。
-## 12800004 按键事件处理异常
+## 12800004 不是输入法应用
**错误信息**
-Key event processing error.
+Not an input method extension.
**错误描述**
-当按键事件异常时,系统会报此错误码。
+当其他应用调用了仅支持输入法应用调用的接口时,系统会报此错误码。
**可能原因**
-按键事件分发、消费、监听异常时会报错。
+在其他应用中调用了仅支持输入法应用调用的接口。
**处理步骤**
-无
+在输入法应用中调用此接口。
## 12800005 配置固化失败
@@ -146,4 +146,22 @@ Input method manager service error.
**处理步骤**
-通过ps -A|grep inputmethod查看是否存在输入法服务的进程号,如果存在,则服务正常。
\ No newline at end of file
+通过ps -A|grep inputmethod查看是否存在输入法服务的进程号,如果存在,则服务正常。
+
+## 12800009 输入法客户端未绑定
+
+**错误信息**
+
+Input method client is detached.
+
+**错误描述**
+
+当前应用未绑定输入法应用。
+
+**可能原因**
+
+当前应用在没有绑定输入法的情况下执行了比如showTextInput、hideTextInput等操作。
+
+**处理步骤**
+
+先执行attach接口操作即可。
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-common-gradient.md b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-common-gradient.md
index 5a8da0fdde73adcd3714953cb1b580397deab18e..12cc4da8db8569355d6d0d000627b2e9d1a03515 100644
--- a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-common-gradient.md
+++ b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-common-gradient.md
@@ -33,54 +33,55 @@ background: repeating-linear-gradient(direction/angle, color, color, ...);
支持以下四种方式:\#ff0000、\#ffff0000、rgb(255, 0, 0)、rgba(255, 0, 0, 1),需要指定至少两种颜色。
-- 参数
+**参数:**
- | 名称 | 类型 | 默认值 | 必填 | 描述 |
- | --------- | ---------------------------------------- | ---------------------------- | ---- | ---------------------------------------- |
- | direction | to <side-or-corner> <side-or-corner> = [left \| right] \|\| [top \| bottom] | to bottom (由上到下渐变) | 否 | 指定过渡方向,如:to left (从右向左渐变) ,或者to bottom right (从左上角到右下角)。 |
- | angle | <deg> | 180deg | 否 | 指定过渡方向,以元素几何中心为坐标原点,水平方向为X轴,angle指定了渐变线与Y轴的夹角(顺时针方向)。 |
- | color | <color> [<length>\|<percentage>] | - | 是 | 定义使用渐变样式区域内颜色的渐变效果。 |
+| 名称 | 类型 | 默认值 | 必填 | 描述 |
+| --------- | ---------------------------------------- | ---------------------------- | ---- | ---------------------------------------- |
+| direction | to <side-or-corner> <side-or-corner> = [left \| right] \|\| [top \| bottom] | to bottom (由上到下渐变) | 否 | 指定过渡方向,如:to left (从右向左渐变) ,或者to bottom right (从左上角到右下角)。 |
+| angle | <deg> | 180deg | 否 | 指定过渡方向,以元素几何中心为坐标原点,水平方向为X轴,angle指定了渐变线与Y轴的夹角(顺时针方向)。 |
+| color | <color> [<length>\|<percentage>] | - | 是 | 定义使用渐变样式区域内颜色的渐变效果。 |
-- 示例
+**示例:**
- 1. 默认渐变方向为从上向下渐变。
+1. 默认渐变方向为从上向下渐变。
- ```css
- #gradient {
- height: 300px;
- width: 600px;
- /* 从顶部开始向底部由红色向绿色渐变 */
- background: linear-gradient(red, #00ff00);
- }
- ```
+ ```css
+ #gradient {
+ height: 300px;
+ width: 600px;
+ /* 从顶部开始向底部由红色向绿色渐变 */
+ background: linear-gradient(red, #00ff00);
+ }
+ ```
- 
+ 
- 2. 45度夹角渐变。
+2. 45度夹角渐变。
+ ```css
+ /* 45度夹角,从红色渐变到绿色 */
+ background: linear-gradient(45deg, rgb(255, 0, 0),rgb(0, 255, 0));
+ ```
- ```css
- /* 45度夹角,从红色渐变到绿色 */
- background: linear-gradient(45deg, rgb(255, 0, 0),rgb(0, 255, 0));
- ```
+ 
- 
+3. 设置方向从左向右渐变。
- 3. 设置方向从左向右渐变。
+ ```css
+ /* 从左向右渐变,在距离左边90px和距离左边360px (600*0.6) 之间270px宽度形成渐变 */
+ background: linear-gradient(to right, rgb(255, 0, 0) 90px, rgb(0, 255, 0) 60%);
+ ```
- ```css
- /* 从左向右渐变,在距离左边90px和距离左边360px (600*0.6) 之间270px宽度形成渐变 */
- background: linear-gradient(to right, rgb(255, 0, 0) 90px, rgb(0, 255, 0) 60%);
- ```
+ 
+4. 重复渐变。
- 
+ ```css
+ /* 从左向右重复渐变,重复渐变区域30px(60-30)透明度0.5 */
+ background: repeating-linear-gradient(to right, rgba(255, 255, 0, 1) 30vp,rgba(0, 0, 255, .5) 60vp);
+ ```
+
+ 
- 4. 重复渐变。
- ```css
- /* 从左向右重复渐变,重复渐变区域30px(60-30)透明度0.5 */
- background: repeating-linear-gradient(to right, rgba(255, 255, 0, 1) 30vp,rgba(0, 0, 255, .5) 60vp);
- ```
- 
diff --git a/zh-cn/application-dev/reference/native-apis/image.md b/zh-cn/application-dev/reference/native-apis/image.md
index d6ac40591e33ceec935da528326be6c60c95dedf..6c2ac829b6e04304f410f64fdf3b9652b9aa141f 100644
--- a/zh-cn/application-dev/reference/native-apis/image.md
+++ b/zh-cn/application-dev/reference/native-apis/image.md
@@ -3,6 +3,7 @@
提供获取pixelmap的数据和信息的接口方法。
+使用该文件下接口,需要依赖:libpixelmap_ndk.z.so
@Syscap SystemCapability.Multimedia.Image
diff --git a/zh-cn/application-dev/reference/syscap-list.md b/zh-cn/application-dev/reference/syscap-list.md
index 937ebfdbd333267cb5e78e4e02b43201247dff19..73125c9021b84d27bc022059d4465179c053a541 100644
--- a/zh-cn/application-dev/reference/syscap-list.md
+++ b/zh-cn/application-dev/reference/syscap-list.md
@@ -1669,3 +1669,11 @@ Pointer输入增强能力
| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ |
| 是 | 是 | 是 | 是 | 是 | 是 | 是 | 是 |
+## SystemCapability.Msdp.DeviceStatus.Cooperate
+
+设备状态感知
+
+| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router |
+| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ |
+| 是 | 否 | 否 | 是 | 否 | 否 | 否 | 否 |
+
diff --git a/zh-cn/application-dev/security/permission-list.md b/zh-cn/application-dev/security/permission-list.md
index 3113d79b0055660eebf1feba67f02553c3e4f56f..bf0687b8aec01d6853dd065eb0b0820784399e40 100644
--- a/zh-cn/application-dev/security/permission-list.md
+++ b/zh-cn/application-dev/security/permission-list.md
@@ -1836,7 +1836,7 @@
**授权方式**:system_grant
-**ACL使能**:TURE
+**ACL使能**:TRUE
## ohos.permission.GET_DISTRIBUTED_ACCOUNTS
@@ -1846,7 +1846,7 @@
**授权方式**:system_grant
-**ACL使能**:TURE
+**ACL使能**:TRUE
## ohos.permission.GET_LOCAL_ACCOUNTS
@@ -1856,7 +1856,7 @@
**授权方式**:system_grant
-**ACL使能**:TURE
+**ACL使能**:TRUE
## ohos.permission.READ_HIVIEW_SYSTEM
diff --git a/zh-cn/application-dev/ui/arkts-common-components-xcomponent.md b/zh-cn/application-dev/ui/arkts-common-components-xcomponent.md
index b3fb7674e968e5153a9215a62e9357727bed702d..d503763d71618f8bbfbc742048eae2727d9e2fbd 100644
--- a/zh-cn/application-dev/ui/arkts-common-components-xcomponent.md
+++ b/zh-cn/application-dev/ui/arkts-common-components-xcomponent.md
@@ -107,7 +107,7 @@ extern "C" __attribute__((constructor)) void RegisterModule(void)
### 解析XComponent组件的NativeXComponent实例
-NativeXComponent为XComponent提供了在native层的实例,可作为js层和native层XComponent绑定的桥梁。XComponent所提供的的NDK接口都依赖于该实例。具体NKD接口可参考[Native XComponent](../reference/native-apis/_o_h___native_x_component.md)。
+NativeXComponent为XComponent提供了在native层的实例,可作为js层和native层XComponent绑定的桥梁。XComponent所提供的的NDK接口都依赖于该实例。具体NDK接口可参考[Native XComponent](../reference/native-apis/_o_h___native_x_component.md)。
可以在模块被加载时的回调内(即[Napi模块注册](#napi模块注册)中的Init函数)解析获得NativeXComponent实例
diff --git a/zh-cn/application-dev/website.md b/zh-cn/application-dev/website.md
index 0fe2f82f11864cdd0d3ca48233164018371d5631..690e0006f5f10c397993170259611e21f3bd6454 100644
--- a/zh-cn/application-dev/website.md
+++ b/zh-cn/application-dev/website.md
@@ -31,16 +31,41 @@
- [module对象内部结构](quick-start/module-structure.md)
- [资源分类与访问](quick-start/resource-categories-and-access.md)
- 学习ArkTS语言
- - [初识ArkTS语言](quick-start/arkts-get-started.md)
- - ArkTS语法(声明式UI)
- - [基本UI描述](quick-start/arkts-basic-ui-description.md)
+ - [初识ArkTS语言](quick-start/arkts-get-started.md)
+ - 基本语法
+ - [基本语法概述](quick-start/arkts-basic-syntax-overview.md)
+ - [声明式UI描述](quick-start/arkts-declarative-ui-description.md)
+ - 自定义组件
+ - [创建自定义组件](quick-start/arkts-create-custom-components.md)
+ - [页面和自定义组件生命周期](quick-start/arkts-page-custom-components-lifecycle.md)
+ - [\@Builder:自定义构建函数](quick-start/arkts-builder.md)
+ - [\@BuilderParam:引用\@Builder函数](quick-start/arkts-builderparam.md)
+ - [\@Styles:定义组件重用样式](quick-start/arkts-style.md)
+ - [\@Extend:定义扩展组件样式](quick-start/arkts-extend.md)
+ - [stateStyles:多态样式](quick-start/arkts-statestyles.md)
- 状态管理
- - [基本概念](quick-start/arkts-state-mgmt-concepts.md)
- - [页面级变量的状态管理](quick-start/arkts-state-mgmt-page-level.md)
- - [应用级变量的状态管理](quick-start/arkts-state-mgmt-application-level.md)
- - [动态构建UI元素](quick-start/arkts-dynamic-ui-elememt-building.md)
- - [渲染控制](quick-start/arkts-rendering-control.md)
- - [使用限制与扩展](quick-start/arkts-restrictions-and-extensions.md)
+ - [状态管理概述](quick-start/arkts-state-management-overview.md)
+ - 管理组件拥有的状态
+ - [\@State:组件内状态](quick-start/arkts-state.md)
+ - [\@Prop:父子单向同步](quick-start/arkts-prop.md)
+ - [\@Link:父子双向同步](quick-start/arkts-link.md)
+ - [\@Provide和\@Consume:与后代组件双向同步](quick-start/arkts-provide-and-consume.md)
+ - [\@Observed和\@ObjectLink:嵌套类对象属性变化](quick-start/arkts-observed-and-objectlink.md)
+ - 管理应用拥有的状态
+ - [管理应用拥有的状态概述](quick-start/arkts-application-state-management-overview.md)
+ - [LocalStorage:页面级UI状态存储](quick-start/arkts-localstorage.md)
+ - [AppStorage:应用全局的UI状态存储](quick-start/arkts-appstorage.md)
+ - [PersistentStorage:持久化存储UI状态](quick-start/arkts-persiststorage.md)
+ - [Environment:设备环境查询](quick-start/arkts-environment.md)
+ - 其他状态管理
+ - [其他状态管理概述](quick-start/arkts-other-state-mgmt-functions-overview.md)
+ - [\@Watch:状态变量更改通知](quick-start/arkts-watch.md)
+ - [$$语法:内置组件双向同步](quick-start/arkts-two-way-sync.md)
+ - 渲染控制
+ - [渲染控制概述](quick-start/arkts-rendering-control-overview.md)
+ - [if/else:条件渲染](quick-start/arkts-rendering-control-ifelse.md)
+ - [ForEach:循环渲染](quick-start/arkts-rendering-control-foreach.md)
+ - [LazyForEach:数据懒加载](quick-start/arkts-rendering-control-lazyforeach.md)
- 开发
- 应用模型
- 应用模型概述
@@ -174,31 +199,63 @@
- UI开发
- [方舟开发框架(ArkUI)概述](ui/arkui-overview.md)
- 基于ArkTS的声明式开发范式
- - [概述](ui/ui-ts-overview.md)
- - [声明式UI开发指导](ui/ui-ts-developing-intro.md)
- - 声明式UI开发实例
- - [创建简单视图](ui/ui-ts-creating-simple-page.md)
- - 构建完整实例
- - [构建食物数据模型](ui/ui-ts-building-data-model.md)
- - [构建食物列表List布局](ui/ui-ts-building-category-list-layout.md)
- - [构建食物分类Grid布局](ui/ui-ts-building-category-grid-layout.md)
- - [页面跳转与数据传递](ui/ui-ts-page-redirection-data-transmission.md)
- - 添加闪屏动画
- - [绘制图像](ui/ui-ts-drawing-feature.md)
- - [添加动画效果](ui/ui-ts-animation-feature.md)
- - [常用组件说明](ui/ui-ts-components-intro.md)
- - 常见布局开发指导
- - 自适应布局
- - [线性布局](ui/ui-ts-layout-linear.md)
- - [层叠布局](ui/ui-ts-layout-stack.md)
- - [弹性布局](ui/ui-ts-layout-flex.md)
- - [网格布局](ui/ui-ts-layout-grid.md)
- - 响应式布局
- - [栅格布局](ui/ui-ts-layout-grid-container-new.md)
- - [媒体查询](ui/ui-ts-layout-mediaquery.md)
- - [自定义组件的生命周期](ui/ui-ts-custom-component-lifecycle-callbacks.md)
- - [Web组件开发指导](ui/ui-ts-components-web.md)
- - [性能提升的推荐方法](ui/ui-ts-performance-improvement-recommendation.md)
+ - [UI开发(ArkTS声明式开发范式)概述](ui/arkts-ui-development-overview.md)
+ - 开发布局
+ - [布局概述](ui/arkts-layout-development-overview.md)
+ - 构建布局
+ - [线性布局](ui/arkts-layout-development-linear.md)
+ - [层叠布局](ui/arkts-layout-development-stack-layout.md)
+ - [弹性布局](ui/arkts-layout-development-flex-layout.md)
+ - [相对布局](ui/arkts-layout-development-relative-layout.md)
+ - [栅格布局](ui/arkts-layout-development-grid-layout.md)
+ - [媒体查询](ui/arkts-layout-development-media-query.md)
+ - [创建列表](ui/arkts-layout-development-create-list.md)
+ - [创建网格](ui/arkts-layout-development-create-grid.md)
+ - [创建轮播](ui/arkts-layout-development-create-looping.md)
+ - [改善布局性能](ui/arkts-layout-development-performance-boost.md)
+ - 添加组件
+ - 添加常用组件
+ - [按钮](ui/arkts-common-components-button.md)
+ - [单选框](ui/arkts-common-components-radio-button.md)
+ - [切换按钮](ui/arkts-common-components-switch.md)
+ - [进度条](ui/arkts-common-components-progress-indicator.md)
+ - [文本显示](ui/arkts-common-components-text-display.md)
+ - [文本输入](ui/arkts-common-components-text-input.md)
+ - [自定义弹窗](ui/arkts-common-components-custom-dialog.md)
+ - [视频播放](ui/arkts-common-components-video-player.md)
+ - [XComponent](ui/arkts-common-components-xcomponent.md)
+ - 添加气泡和菜单
+ - [气泡提示](ui/arkts-popup-and-menu-components-popup.md)
+ - [菜单](ui/arkts-popup-and-menu-components-menu.md)
+ - 设置页面路由和组件导航
+ - [页面路由](ui/arkts-routing.md)
+ - 组件导航
+ - [Navigation](ui/arkts-navigation-navigation.md)
+ - [Tabs](ui/arkts-navigation-tabs.md)
+ - 显示图形
+ - [显示图片](ui/arkts-graphics-display.md)
+ - [绘制几何图形](ui/arkts-geometric-shape-drawing.md)
+ - [使用画布绘制自定义图形](ui/arkts-drawing-customization-on-canvas.md)
+ - 使用动画
+ - [动画概述](ui/arkts-animation-overview.md)
+ - 页面内的动画
+ - [布局更新动画](ui/arkts-layout-update-animation.md)
+ - [组件内转场动画](ui/arkts-transition-animation-within-component.md)
+ - [弹簧曲线动画](ui/arkts-spring-animation.md)
+ - 页面间的动画
+ - [放大缩小视图](ui/arkts-zoom-animation.md)
+ - [页面转场动画](ui/arkts-page-transition-animation.md)
+ - 支持交互事件
+ - [交互事件概述](ui/arkts-event-overview.md)
+ - 使用通用事件
+ - [触屏事件](ui/arkts-common-events-touch-screen-event.md)
+ - [键鼠事件](ui/arkts-common-events-device-input-event.md)
+ - [焦点事件](ui/arkts-common-events-focus-event.md)
+ - 使用手势事件
+ - [绑定手势方法](ui/arkts-gesture-events-binding.md)
+ - [单一手势](ui/arkts-gesture-events-single-gesture.md)
+ - [组合手势](ui/arkts-gesture-events-combined-gestures.md)
+ - [性能提升的推荐方法](ui/arkts-performance-improvement-recommendation.md)
- 兼容JS的类Web开发范式
- [概述](ui/ui-js-overview.md)
- 框架说明
@@ -271,6 +328,22 @@
- [动画动效](ui/ui-js-animate-dynamic-effects.md)
- [动画帧](ui/ui-js-animate-frame.md)
- [自定义组件](ui/ui-js-custom-components.md)
+ - Web
+ - [Web组件概述](web/web-component-overview.md)
+ - [使用Web组件加载页面](web/web-page-loading-with-web-components.md)
+ - 设置基本属性和事件
+ - [设置深色模式](web/web-set-dark-mode.md)
+ - [上传文件](web/web-file-upload.md)
+ - [在新窗口中打开页面](web/web-open-in-new-window.md)
+ - [管理位置权限](web/web-geolocation-permission.md)
+ - 在应用中使用前端页面JavaScript
+ - [应用侧调用前端页面函数](web/web-in-app-frontend-page-function-invoking.md)
+ - [前端页面调用应用侧函数](web/web-in-page-app-function-invoking.md)
+ - [建立应用侧与前端页面数据通道](web/web-app-page-data-channel.md)
+ - [管理页面跳转及浏览记录导航](web/web-redirection-and-browsing-history-mgmt.md)
+ - [管理Cookie及数据存储](web/web-cookie-and-data-storage-mgmt.md)
+ - [自定义页面请求响应](web/web-resource-interception-request-mgmt.md)
+ - [使用Devtools工具调试前端页面](web/web-debugging-with-devtools.md)
- 通知
- [通知概述](notification/notification-overview.md)
- [订阅通知(仅对系统应用开放)](notification/notification-subscription.md)
@@ -1465,4 +1538,4 @@
- [IDE使用常见问题](faqs/faqs-ide.md)
- [hdc_std命令使用常见问题](faqs/faqs-hdc-std.md)
- [开发板使用常见问题](faqs/faqs-development-board.md)
-
+
diff --git a/zh-cn/third-party-cases/book-flip-animation.md b/zh-cn/third-party-cases/book-flip-animation.md
index 10723d3f731809c3c51c880a598bbd7168b7008d..710d2d773d350fd550d008726b55bf41cdbdfdbd 100644
--- a/zh-cn/third-party-cases/book-flip-animation.md
+++ b/zh-cn/third-party-cases/book-flip-animation.md
@@ -17,7 +17,7 @@
## 实现思路
-如图,我们分上下两层、左右两侧建立4个文本组件(下文用A、B、C、D代称),左右两侧分别代表打开书籍的左右两面,上下两层堆叠放置。
+如图,分上下两层、左右两侧建立4个文本组件(下文用A、B、C、D代称),左右两侧分别代表打开书籍的左右两面,上下两层堆叠放置。
当B沿旋转轴旋转180度覆盖在A上时,就体现为翻页效果。一个翻页动作的完成包括以下几步:
1. B沿旋转轴旋转180度。
@@ -33,10 +33,11 @@
## 开发步骤
-1. 创建文本组件
- 首先,我们看到动效中用到了4个文本组件,我们可以定义一个文本组件,然后对其进行重复调用。创建时我们为其添加[rotate](../application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md)属性,用来控制组件的旋转。
- 由于各组件旋转的角度和旋转中心不同,需要父组件在调用时传入对应的参数,所以我们为对应变量添加[@Prop](../application-dev/quick-start/arkts-prop.md)装饰器,用来控制变量传递。具体代码如下:
- ```
+1. 创建文本组件。
+
+ 动效中用到了4个文本组件,因此可以先定义一个文本组件,然后对其进行重复调用。同时为文本组件添加[rotate](../application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md)属性,用来控制组件的旋转。
+ 由于各组件旋转的角度和旋转中心不同,需要父组件在调用时传入对应的参数,所以需要为对应变量添加[@Prop](../application-dev/quick-start/arkts-prop.md)装饰器,用来控制变量传递。具体代码如下:
+ ```ts
@Component
struct BookCard{
// 为变量添加@Prop装饰器,用于接收父组件的动态传参
@@ -67,9 +68,10 @@
}
}
```
-2. 创建父组件框架
- 由于文本组件分为上下两层,所以我们在父组件中采用[Stack](../application-dev/reference/arkui-ts/ts-container-stack.md)组件进行层叠布局。同时使用[Divider](../application-dev/reference/arkui-ts/ts-basic-components-divider.md)组件作为书籍两个页面间的分隔线。具体代码如下:
- ```
+2. 创建父组件框架。
+
+ 由于文本组件分为上下两层,所以在父组件中采用[Stack](../application-dev/reference/arkui-ts/ts-container-stack.md)组件进行层叠布局。同时使用[Divider](../application-dev/reference/arkui-ts/ts-basic-components-divider.md)组件作为书籍两个页面间的分隔线。具体代码如下:
+ ```ts
@Entry
@Component
struct BookAnimation {
@@ -102,14 +104,14 @@
}
```
-3. 添加翻页动效
+3. 添加翻页动效。
- 最后我们通过以下几点来为静态的组件添加动效:
+ 最后通过以下几点来为静态的组件添加动效:
- 根据**实现思路**章节的分析,在父组件中定义对应的变量,并在调用子组件时分别传入子组件。
- 自定义book_animate函数,在其中使用animateTo方法添加动画效果,同时控制动画的时长,以及动画过程中各元素状态的改变。
- 在[aboutToAppear](../application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md#abouttoappear)方法中,使用[setInterval](../application-dev/reference/apis/js-apis-timer.md)方法重复调用book_animate函数,以实现连续翻页动效。
具体代码如下:
- ```
+ ```ts
@Entry
@Component
struct BookAnimation {
@@ -177,11 +179,11 @@
}
}
```
- 通过以上步骤我们就可以实现翻页动效了。
+ 通过以上步骤就可以实现翻页动效了。
## 完整代码
示例完整代码如下:
-```
+```ts
@Component
struct BookCard{
@Prop num:number
diff --git a/zh-cn/third-party-cases/different-operations-for-one-component.md b/zh-cn/third-party-cases/different-operations-for-one-component.md
index 8a053e2c181ee79c2778394b392004fd6b6b240f..327cd3f4632d7564eec8c1a561f994208e9c2d92 100644
--- a/zh-cn/third-party-cases/different-operations-for-one-component.md
+++ b/zh-cn/third-party-cases/different-operations-for-one-component.md
@@ -1,18 +1,19 @@
# 如何为同一组件在不同场景下绑定不同的业务逻辑
## 场景介绍
-我们在应用开发过程中经常遇到这样的场景:在不同的地方需要呈现同样的UI效果,为了简化处理,我们往往会把对应的UI元素封装成自定义组件,然后在用到的地方进行调用。但是,通常情况下,UI展示往往伴随着动态交互,而且在不同场景下需要做不同的交互处理。
+在应用开发过程中经常遇到这样的场景:在不同的地方需要呈现同样的UI效果,为了简化处理,往往会把对应的UI元素封装成自定义组件,然后在用到的地方进行调用。但是,通常情况下,UI展示往往伴随着动态交互,而且在不同场景下需要做不同的交互处理。
+
*比如:A、B两个页面都有返回按钮,但是在A页面中点击返回按钮是返回上一页,在B页面点击返回按钮是直接退出当前应用。同样是点击返回按钮,但是业务处理逻辑是不同的。*
那么在不同场景下调用同一组件的时候如何实现不同的交互逻辑呢?这就引出了本文要讲的内容。
## 实现思路
-要使同一组件实现不同效果,我们很容易就想到通过变量传参进行控制,而不是直接在程序中采用固定值,这样我们就可以根据不同场景传入不同参数从而实现不同效果。
-我们通常使用传参的方式改变组件的属性,比如:大小、边框、背景色、字体等等,同样的,我们也可以通过传参的方式改变组件绑定的业务逻辑,只不过,此时我们传入的是方法,然后在对应方法中写入具体的业务逻辑。
+要使同一组件实现不同效果,我们很容易就想到通过变量传参进行控制,而不是直接在程序中采用固定值,这样就可以根据不同场景传入不同参数从而实现不同效果。
+通过传参的方式改变组件的属性,比如:大小、边框、背景色、字体等等,同样的,也可以通过传参的方式改变组件绑定的业务逻辑,只不过此时传入的是含有业务逻辑的方法。
接下来我们用一个简单的例子讲解如何实现。
## 开发示例
-本示例将在一个页面中两次引用同一个按钮,然后为两次引用加入不同的处理逻辑,第一次引用中,点击按钮跳转到‘’Hello World!’‘页面;第二次引用中,点击按钮跳转到’‘Hello ArkTS!’‘页面。
+本示例将在一个页面中两次引用同一个按钮,然后为两次引用加入不同的处理逻辑,第一次引用中,点击按钮跳转到“Hello World!”页面;第二次引用中,点击按钮跳转到“Hello ArkTS!”页面。
### 环境要求
- IDE:DevEco Studio 3.1 Beta1
@@ -20,7 +21,8 @@
### 开发步骤
1. 创建按钮组件
- 首先,让我们创建被引用的按钮组件。
+
+ 首先,创建被引用的按钮组件。
这里需要注意的是,由于按钮要绑定不同的处理逻辑,所以我们在点击事件中不要写入固定的处理逻辑,而是传入一个自定义的空方法,该方法的逻辑在父组件中实现,然后传入。具体代码如下:
```ts
@Component
@@ -41,6 +43,7 @@
```
2. 在父组件中引用按钮组件
+
接下来,我们在父组件中引用两次第1步中创建的按钮组件。具体代码如下:
```ts
@Entry
@@ -61,8 +64,9 @@
```
3. 在父组件中传入处理逻辑
- 以上两步已经把我们的页面框架搭好了,接下来就是给按钮组件传入处理逻辑了,这也是最重要的一步。
- 我们在第1步中为按钮组件的点击事件绑定了一个空函数,现在我们在父组件中创建一个带有具体处理逻辑的函数,并将其传入按钮组件中。在父组件中可以通过为同一函数传入不同参数来为两个按钮组件绑定不同逻辑,也可以通过不同函数来实现,本例中采用前者进行实现。具体代码如下:
+
+ 以上两步已经把页面框架搭好了,接下来给按钮组件传入处理逻辑,这也是最重要的一步。
+ 在第1步中为按钮组件的点击事件绑定了一个空函数,现在我们在父组件中创建一个带有具体处理逻辑的函数,并将其传入按钮组件中。在父组件中可以通过为同一函数传入不同参数来为两个按钮组件绑定不同逻辑,也可以通过不同函数来实现,本例中采用前者进行实现。具体代码如下:
```ts
import router from '@ohos.router'
@Entry
@@ -89,8 +93,8 @@
}
```
- 通过以上步骤我们实现了在为同一按钮组件绑定不同的业务处理逻辑,接下来就让我们看下效果吧!
- 注意:文中的‘’Hello World!’‘页面和’‘Hello ArkTS!’‘页面不是本文说明的重点,所以本文中不做开发介绍。
+ 通过以上步骤我们实现了在为同一按钮组件绑定不同的业务处理逻辑,接下来看下效果吧!
+ 注意:文中的“Hello World!”页面和“Hello ArkTS!”页面不是本文说明的重点,所以本文中不做开发介绍。

diff --git a/zh-cn/third-party-cases/how-to-group-contacts-with-alphabet.md b/zh-cn/third-party-cases/how-to-group-contacts-with-alphabet.md
index 1d76c81255b6c221d1c32eb1dc62298237dd85f1..80ff0a0ff1f011aad359acddbf0362ad74c73057 100644
--- a/zh-cn/third-party-cases/how-to-group-contacts-with-alphabet.md
+++ b/zh-cn/third-party-cases/how-to-group-contacts-with-alphabet.md
@@ -1,8 +1,8 @@
-# 如何按字母分组展示联系人(仅UI)
+# 如何按字母分组展示联系人
## 场景说明
在通讯录中,需要将联系人按照姓氏的首字母进行分组排列,从而更方便联系人的查找;联系人列表右侧的字母导航可以随列表的滑动而定位到对应字母处;同时,也可以通过字母导航控制列表跳到指定联系人分组。
-本例即为大家介绍如何通过实现上述场景。
+本例即为大家介绍如何实现上述场景。
## 效果呈现
本示例最终效果如下:
@@ -23,7 +23,7 @@
## 开发步骤
针对上述关键特性,具体实现步骤如下:
-1、先通过Stack、List、ListItemGroup、AlphabetIndexer等关键组件将UI框架搭建起来。
+1、通过Stack、List、ListItemGroup、AlphabetIndexer等关键组件将UI框架搭建起来。
先构建列表数据,其中Contact为联系人数据类。
```ts
contactGroups: object[] = [
@@ -113,7 +113,7 @@ struct ContactList{

-2、接下来我们为UI框架添加逻辑控制。首先,通过List的onScrollIndex事件获取到列表滑动位置的索引,并将索引同步给右侧字母表的selected属性,从而在滑动联系人时,使右侧字母导航随之变动,关键代码如下:
+2、接下来为UI框架添加逻辑控制。首先,通过List的onScrollIndex事件获取到列表滑动位置的索引,并将索引同步给右侧字母表的selected属性,从而在滑动联系人时,使右侧字母导航随之变动,关键代码如下:
```ts
...
// 创建动态变量,用于指定字母导航的选择项