未验证 提交 0838f38d 编写于 作者: O openharmony_ci 提交者: Gitee

!2986 修改敏感词

Merge pull request !2986 from LiAn/master
......@@ -220,6 +220,10 @@
- Distributed Call Chain Tracing
- [Overview of Distributed Call Chain Tracing](dfx/hitracechain-overview.md)
- [Development of Distributed Call Chain Tracing](dfx/hitracechain-guidelines.md)
- Internationalization
- [Overview](internationalization/international-overview.md)
- [Internationalization Development (intl)](internationalization/intl-guidelines.md)
- [Internationalization Development (i18n)](internationalization/i18n-guidelines.md)
- Tools
- [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md)
- Hands-On Tutorials
......@@ -475,7 +479,7 @@
- [Built-in Enums](reference/arkui-ts/ts-appendix-enums.md)
- APIs
- Ability Framework
- [@ohos.ability.dataUriUtils](reference/apis/js-apis-DataUriUtils.md)
- [@ohos.ability.errorCode ](reference/apis/js-apis-ability-errorcode.md)
- [@ohos.ability.wantConstant](reference/apis/js-apis-ability-wantConstant.md)
......@@ -519,65 +523,65 @@
- [ProcessRunningInfo](reference/apis/js-apis-processrunninginfo.md)
- [ServiceExtensionContext](reference/apis/js-apis-service-extension-context.md)
- [shellCmdResult](reference/apis/js-apis-application-shellCmdResult.md)
- Common Event and Notification
- [@ohos.commonEvent](reference/apis/js-apis-commonEvent.md)
- [@ohos.events.emitter](reference/apis/js-apis-emitter.md)
- [@ohos.notification](reference/apis/js-apis-notification.md)
- [@ohos.reminderAgent](reference/apis/js-apis-reminderAgent.md)
- [EventHub](reference/apis/js-apis-eventhub.md)
- Bundle Management
- [@ohos.bundle](reference/apis/js-apis-Bundle.md)
- [@ohos.bundleState ](reference/apis/js-apis-deviceUsageStatistics.md)
- [@ohos.zlib](reference/apis/js-apis-zlib.md)
- UI Page
- [@ohos.animator](reference/apis/js-apis-animator.md)
- Graphics
- [@ohos.display ](reference/apis/js-apis-display.md)
- [@ohos.screenshot](reference/apis/js-apis-screenshot.md)
- [@ohos.window](reference/apis/js-apis-window.md)
- [webgl](reference/apis/js-apis-webgl.md)
- [webgl2](reference/apis/js-apis-webgl2.md)
- Media
- [@ohos.multimedia.audio](reference/apis/js-apis-audio.md)
- [@ohos.multimedia.camera](reference/apis/js-apis-camera.md)
- [@ohos.multimedia.image](reference/apis/js-apis-image.md)
- [@ohos.multimedia.media](reference/apis/js-apis-media.md)
- [@ohos.multimedia.medialibrary](reference/apis/js-apis-medialibrary.md)
- Resource Management
- [@ohos.i18n](reference/apis/js-apis-i18n.md)
- [@ohos.intl](reference/apis/js-apis-intl.md)
- [@ohos.resourceManager](reference/apis/js-apis-resource-manager.md)
- Resource Scheduling
- [@ohos.backgroundTaskManager](reference/apis/js-apis-backgroundTaskManager.md)
- [@ohos.workScheduler ](reference/apis/js-apis-workScheduler.md)
- [@ohos.WorkSchedulerExtensionAbility](reference/apis/js-apis-WorkSchedulerExtensionAbility.md)
- Custom Management
- [@ohos.configPolicy](reference/apis/js-apis-config-policy.md)
- [@ohos.enterpriseDeviceManager](reference/apis/js-apis-enterprise-device-manager.md)
- Security
- [@ohos.abilityAccessCtrl](reference/apis/js-apis-abilityAccessCtrl.md)
- [@ohos.security.huks ](reference/apis/js-apis-huks.md)
- [@ohos.userIAM.userAuth ](reference/apis/js-apis-useriam-userauth.md)
- Data Management
- [@ohos.data.dataAbility ](reference/apis/js-apis-data-ability.md)
- [@ohos.data.distributedData](reference/apis/js-apis-distributed-data.md)
- [@ohos.data.distributedDataObject](reference/apis/js-apis-data-distributedobject.md)
......@@ -585,18 +589,18 @@
- [@ohos.data.rdb](reference/apis/js-apis-data-rdb.md)
- [@ohos.settings](reference/apis/js-apis-settings.md)
- [resultSet](reference/apis/js-apis-data-resultset.md)
- File Management
- [@ohos.environment](reference/apis/js-apis-environment.md)
- [@ohos.fileio](reference/apis/js-apis-fileio.md)
- [@ohos.fileManager](reference/apis/js-apis-filemanager.md)
- [@ohos.statfs](reference/apis/js-apis-statfs.md)
- [@ohos.storageStatistics](reference/apis/js-apis-storage-statistics.md)
- [@ohos.volumeManager](reference/apis/js-apis-volumemanager.md)
- Telephony Service
- [@ohos.contact](reference/apis/js-apis-contact.md)
- [@ohos.telephony.call](reference/apis/js-apis-call.md)
- [@ohos.telephony.observer](reference/apis/js-apis-observer.md)
......@@ -604,23 +608,23 @@
- [@ohos.telephony.sim](reference/apis/js-apis-sim.md)
- [@ohos.telephony.sms](reference/apis/js-apis-sms.md)
- [@ohos.telephony.data](reference/apis/js-apis-telephony-data.md)
- Network Management
- [@ohos.net.connection](reference/apis/js-apis-net-connection.md)
- [@ohos.net.http](reference/apis/js-apis-http.md)
- [@ohos.request](reference/apis/js-apis-request.md)
- [@ohos.net.socket](reference/apis/js-apis-socket.md)
- [@ohos.net.webSocket](reference/apis/js-apis-webSocket.md)
- Connectivity
- [@ohos.bluetooth](reference/apis/js-apis-bluetooth.md)
- [@ohos.rpc](reference/apis/js-apis-rpc.md)
- [@ohos.wifi](reference/apis/js-apis-wifi.md)
- [@ohos.wifiext](reference/apis/js-apis-wifiext.md)
- Basic Features
- [@ohos.accessibility](reference/apis/js-apis-accessibility.md)
- [@ohos.faultLogger](reference/apis/js-apis-faultLogger.md)
- [@ohos.hiAppEvent](reference/apis/js-apis-hiappevent.md)
......@@ -636,9 +640,9 @@
- [@ohos.systemTime](reference/apis/js-apis-system-time.md)
- [@ohos.wallpaper](reference/apis/js-apis-wallpaper.md)
- [Timer](reference/apis/js-apis-timer.md)
- Device Management
- [@ohos.batteryInfo ](reference/apis/js-apis-battery-info.md)
- [@ohos.brightness](reference/apis/js-apis-brightness.md)
- [@ohos.deviceInfo](reference/apis/js-apis-device-info.md)
......@@ -656,15 +660,15 @@
- [@ohos.update](reference/apis/js-apis-update.md)
- [@ohos.usb](reference/apis/js-apis-usb.md)
- [@ohos.vibrator](reference/apis/js-apis-vibrator.md)
- Account Management
- [@ohos.account.appAccount](reference/apis/js-apis-appAccount.md)
- [@ohos.account.distributedAccount](reference/apis/js-apis-distributed-account.md)
- [@ohos.account.osAccount](reference/apis/js-apis-osAccount.md)
- Language Base Class Library
- [@ohos.convertxml](reference/apis/js-apis-convertxml.md)
- [@ohos.process](reference/apis/js-apis-process.md)
- [@ohos.uri](reference/apis/js-apis-uri.md)
......@@ -686,13 +690,13 @@
- [@ohos.util.Vector](reference/apis/js-apis-vector.md)
- [@ohos.worker](reference/apis/js-apis-worker.md)
- [@ohos.xml](reference/apis/js-apis-xml.md)
- Test
- [@ohos.application.testRunner](reference/apis/js-apis-testRunner.md)
- [@ohos.uitest](reference/apis/js-apis-uitest.md)
- APIs No Longer Maintained
- [@ohos.bytrace](reference/apis/js-apis-bytrace.md)
- [@ohos.data.storage](reference/apis/js-apis-data-storage.md)
- [@system.app](reference/apis/js-apis-system-app.md)
......
......@@ -22,15 +22,15 @@ The default duration of delayed suspension is 180000 when the battery level is h
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reason | string | Yes| Reason for delayed transition to the suspended state.|
| callback | Callback<void> | Yes| Invoked when a delay is about to time out. Generally, this callback is used to notify the application 6 seconds before the delay times out.|
| Name | Type | Mandatory | Description |
| -------- | -------------------- | --------- | ---------------------------------------- |
| reason | string | Yes | Reason for delayed transition to the suspended state. |
| callback | Callback<void> | Yes | Invoked when a delay is about to time out. Generally, this callback is used to notify the application 6 seconds before the delay times out. |
**Return value**
| Type| Description|
| -------- | -------- |
| [DelaySuspendInfo](#delaysuspendinfo) | Information about the suspension delay.|
| Type | Description |
| ------------------------------------- | --------------------------------------- |
| [DelaySuspendInfo](#delaysuspendinfo) | Information about the suspension delay. |
**Example**
```js
......@@ -50,10 +50,10 @@ Obtains the remaining duration before the application is suspended. This API use
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| requestId | number | Yes| ID of the suspension delay request.|
| callback | AsyncCallback<number> | Yes| Callback used to return the remaining duration before the application is suspended, in milliseconds.|
| Name | Type | Mandatory | Description |
| --------- | --------------------------- | --------- | ---------------------------------------- |
| requestId | number | Yes | ID of the suspension delay request. |
| callback | AsyncCallback<number> | Yes | Callback used to return the remaining duration before the application is suspended, in milliseconds. |
**Example**
......@@ -78,14 +78,14 @@ Obtains the remaining duration before the application is suspended. This API use
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| requestId | number | Yes| ID of the suspension delay request.|
| Name | Type | Mandatory | Description |
| --------- | ------ | --------- | ----------------------------------- |
| requestId | number | Yes | ID of the suspension delay request. |
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the remaining duration before the application is suspended, in milliseconds.|
| Type | Description |
| --------------------- | ---------------------------------------- |
| Promise<number> | Promise used to return the remaining duration before the application is suspended, in milliseconds. |
**Example**
```js
......@@ -107,9 +107,9 @@ Cancels the suspension delay.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| requestId | number | Yes| ID of the suspension delay request.|
| Name | Type | Mandatory | Description |
| --------- | ------ | --------- | ----------------------------------- |
| requestId | number | Yes | ID of the suspension delay request. |
**Example**
```js
......@@ -128,12 +128,12 @@ Requests a continuous task from the system. This API uses an asynchronous callba
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | Yes| Application context.|
| bgMode | [BackgroundMode](#backgroundmode8) | Yes| Background mode requested.|
| wantAgent | [WantAgent](js-apis-wantAgent.md) | Yes| Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------- | --------- | ---------------------------------------- |
| context | [Context](js-apis-Context.md) | Yes | Application context. |
| bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
......@@ -180,16 +180,16 @@ Requests a continuous task from the system. This API uses a promise to return th
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | Yes| Application context.|
| bgMode | [BackgroundMode](#backgroundmode8) | Yes| Background mode requested.|
| wantAgent | [WantAgent](js-apis-wantAgent.md) | Yes| Notification parameter, which is used to specify the target page when a continuous task notification is clicked.|
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------- | --------- | ---------------------------------------- |
| context | [Context](js-apis-Context.md) | Yes | Application context. |
| bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page when a continuous task notification is clicked. |
**Return value**
| Type | Description |
| -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result.|
| Type | Description |
| -------------- | ---------------------------------- |
| Promise\<void> | Promise used to return the result. |
**Example**
```js
......@@ -229,10 +229,10 @@ Requests to cancel a continuous task. This API uses an asynchronous callback to
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | Yes| Application context.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
| Name | Type | Mandatory | Description |
| -------- | ----------------------------- | --------- | ----------------------------------- |
| context | [Context](js-apis-Context.md) | Yes | Application context. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example**
```js
......@@ -260,14 +260,14 @@ Requests to cancel a continuous task. This API uses a promise to return the resu
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | Yes| Application context.|
| Name | Type | Mandatory | Description |
| ------- | ----------------------------- | --------- | -------------------- |
| context | [Context](js-apis-Context.md) | Yes | Application context. |
**Return value**
| Type | Description |
| -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result.|
| Type | Description |
| -------------- | ---------------------------------- |
| Promise\<void> | Promise used to return the result. |
**Example**
```js
......@@ -288,24 +288,24 @@ Provides the information about the suspension delay.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| requestId | number | Yes| ID of the suspension delay request.|
| actualDelayTime | number | Yes| Actual suspension delay duration of the application, in milliseconds.<br>The default duration is 180000 when the battery level is higher than or equal to the broadcast low battery level and 60000 when the battery level is lower than the broadcast low battery level.|
| Name | Type | Mandatory | Description |
| --------------- | ------ | --------- | ---------------------------------------- |
| requestId | number | Yes | ID of the suspension delay request. |
| actualDelayTime | number | Yes | Actual suspension delay duration of the application, in milliseconds.<br>The default duration is 180000 when the battery level is higher than or equal to the broadcast low battery level and 60000 when the battery level is lower than the broadcast low battery level. |
## BackgroundMode<sup>8+</sup>
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
| Name | Value| Description|
| ----------------------- | -------- | -------- |
| DATA_TRANSFER | 1 | Data transfer.|
| AUDIO_PLAYBACK | 2 | Audio playback.|
| AUDIO_RECORDING | 3 | Audio recording.|
| LOCATION | 4 | Positioning and navigation.|
| BLUETOOTH_INTERACTION | 5 | Bluetooth-related task.|
| MULTI_DEVICE_CONNECTION | 6 | Multi-device connection.|
| WIFI_INTERACTION | 7 | WLAN-related (reserved).|
| VOIP | 8 | Voice and video call (reserved).|
| TASK_KEEPING | 9 | Computing task (for PC only).|
| Name | Value | Description |
| ----------------------- | ----- | -------------------------------- |
| DATA_TRANSFER | 1 | Data transfer. |
| AUDIO_PLAYBACK | 2 | Audio playback. |
| AUDIO_RECORDING | 3 | Audio recording. |
| LOCATION | 4 | Positioning and navigation. |
| BLUETOOTH_INTERACTION | 5 | Bluetooth-related task. |
| MULTI_DEVICE_CONNECTION | 6 | Multi-device connection. |
| WIFI_INTERACTION | 7 | WLAN-related (reserved). |
| VOIP | 8 | Voice and video call (reserved). |
| TASK_KEEPING | 9 | Computing task. |
......@@ -17,9 +17,9 @@ import sensor from '@system.sensor';
## Error Codes
| Error Code| Description|
| -------- | -------- |
| 900 | The current device does not support the corresponding sensor.|
| Error Code | Description |
| ---------- | ---------------------------------------- |
| 900 | The current device does not support the corresponding sensor. |
## sensor.subscribeAccelerometer
......@@ -33,19 +33,19 @@ Subscribes to data changes of the acceleration sensor. If this API is called mul
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| interval | string | Yes| Execution frequency of the callback for returning the acceleration sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.|
| success | Function | Yes| Called when the acceleration sensor data changes.|
| fail | Function | No| Callback upon failure.|
| Name | Type | Mandatory | Description |
| -------- | -------- | --------- | ---------------------------------------- |
| interval | string | Yes | Execution frequency of the callback for returning the acceleration sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios. |
| success | Function | Yes | Called when the acceleration sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name| Type| Description|
| -------- | -------- | -------- |
| x | number | Acceleration on the x-axis.|
| y | number | Acceleration on the y-axis.|
| z | number | Acceleration on the z-axis.|
| Name | Type | Description |
| ---- | ------ | --------------------------- |
| x | number | Acceleration on the x-axis. |
| y | number | Acceleration on the y-axis. |
| z | number | Acceleration on the z-axis. |
**Example**
......@@ -92,16 +92,16 @@ Subscribes to data changes of the compass sensor. If this API is called multiple
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| success | Function | Yes| Called when the compass sensor data changes.|
| fail | Function | No| Callback upon failure.|
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the compass sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name| Type| Description|
| -------- | -------- | -------- |
| direction | number | Direction of the device, in degrees.|
| Name | Type | Description |
| --------- | ------ | ------------------------------------ |
| direction | number | Direction of the device, in degrees. |
**Example**
......@@ -143,16 +143,16 @@ Subscribes to data changes of the proximity sensor. If this API is called multip
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| success | Function | Yes| Called when the proximity sensor data changes.|
| fail | Function | No| Callback upon failure.|
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the proximity sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name| Type| Description|
| -------- | -------- | -------- |
| distance | number | Distance between a visible object and the device screen.|
| Name | Type | Description |
| -------- | ------ | ---------------------------------------- |
| distance | number | Distance between a visible object and the device screen. |
**Example**
......@@ -194,16 +194,16 @@ Subscribes to data changes of the ambient light sensor. If this API is called mu
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| success | Function | Yes| Called when the ambient light sensor data changes|
| fail | Function | No| Callback upon failure.|
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the ambient light sensor data changes |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name| Type| Description|
| -------- | -------- | -------- |
| intensity | number | Light intensity, in lux.|
| Name | Type | Description |
| --------- | ------ | ------------------------ |
| intensity | number | Light intensity, in lux. |
**Example**
......@@ -247,16 +247,16 @@ Subscribes to data changes of the step counter sensor. If this API is called mul
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| success | Function | Yes| Called when the step counter sensor data changes.|
| fail | Function | No| Callback upon failure.|
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the step counter sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name| Type| Description|
| -------- | -------- | -------- |
| steps | number | Number of counted steps after the sensor is restarted.<br> |
| Name | Type | Description |
| ----- | ------ | ---------------------------------------- |
| steps | number | Number of counted steps after the sensor is restarted.<br> |
**Example**
......@@ -301,16 +301,16 @@ Subscribes to data changes of the barometer sensor. If this API is called multip
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| success | Function | Yes| Called when the barometer sensor data changes.|
| fail | Function | No| Callback upon failure.|
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the barometer sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name| Type| Description|
| -------- | -------- | -------- |
| pressure | number | Pressure, in pascal.|
| Name | Type | Description |
| -------- | ------ | -------------------- |
| pressure | number | Pressure, in pascal. |
**Example**
......@@ -356,16 +356,16 @@ Subscribes to data changes of the heart rate sensor. If this API is called multi
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| success | Function | Yes| Called when the heart rate sensor data changes. This callback is invoked every five seconds.|
| fail | Function | No| Callback upon failure.|
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the heart rate sensor data changes. This callback is invoked every five seconds. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name| Type| Description|
| -------- | -------- | -------- |
| heartRate | number | Heart rate.|
| Name | Type | Description |
| --------- | ------ | ----------- |
| heartRate | number | Heart rate. |
**Example**
......@@ -410,16 +410,16 @@ Subscribes to changes of the wearing state of a wearable device. If this API is
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| success | Function | Yes| Called when the wearing state changes.|
| fail | Function | No| Callback upon failure.|
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | -------------------------------------- |
| success | Function | Yes | Called when the wearing state changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name| Type| Description|
| -------- | -------- | -------- |
| value | boolean | Whether the wearable device is worn.|
| Name | Type | Description |
| ----- | ------- | ------------------------------------ |
| value | boolean | Whether the wearable device is worn. |
**Example**
......@@ -461,17 +461,17 @@ Obtains the wearing state of a wearable device.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| success | Function | No| Callback upon success.|
| fail | Function | No| Callback upon failure.|
| complete | Function | No| Called when the execution is complete.|
| Name | Type | Mandatory | Description |
| -------- | -------- | --------- | -------------------------------------- |
| success | Function | No | Callback upon success. |
| fail | Function | No | Callback upon failure. |
| complete | Function | No | Called when the execution is complete. |
Return values of the success callback
| Name| Type| Description|
| -------- | -------- | -------- |
| value | boolean | Whether the wearable device is worn.|
| Name | Type | Description |
| ----- | ------- | ------------------------------------ |
| value | boolean | Whether the wearable device is worn. |
**Example**
......@@ -498,18 +498,18 @@ If this API is called multiple times for the same application, the last call tak
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| interval | string | Yes| Interval at which the callback is invoked to return the device orientation sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.|
| success | Function | Yes| Called when the device orientation sensor data changes.|
| fail | Function | No| Callback upon failure.|
| Name | Type | Mandatory | Description |
| -------- | -------- | --------- | ---------------------------------------- |
| interval | string | Yes | Interval at which the callback is invoked to return the device orientation sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios. |
| success | Function | Yes | Called when the device orientation sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name| Type| Description|
| -------- | -------- | -------- |
| alpha | number | Rotation angle around the Z axis when the X/Y axis of the mobile phone coincides with the X/Y axis of the earth.|
| beta | number | Rotation angle around the X axis when the Y/Z axis of the mobile phone coincides with the Y/Z axis of the earth.|
| gamma | number | Rotation angle around the Y axis when the X/Z axis of the mobile phone coincides with the X/Z axis of the earth.|
| Name | Type | Description |
| ----- | ------ | ---------------------------------------- |
| alpha | number | Rotation angle around the Z axis when the X/Y axis of the mobile device coincides with the X/Y axis of the earth. |
| beta | number | Rotation angle around the X axis when the Y/Z axis of the mobile device coincides with the Y/Z axis of the earth. |
| gamma | number | Rotation angle around the Y axis when the X/Z axis of the mobile device coincides with the X/Z axis of the earth. |
**Example**
......@@ -558,19 +558,19 @@ If this API is called multiple times for the same application, the last call tak
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| interval | string | Yes| Interval at which the callback is invoked to return the gyroscope sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.|
| success | Function | Yes| Called when the gyroscope sensor data changes.|
| fail | Function | No| Callback upon failure.|
| Name | Type | Mandatory | Description |
| -------- | -------- | --------- | ---------------------------------------- |
| interval | string | Yes | Interval at which the callback is invoked to return the gyroscope sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios. |
| success | Function | Yes | Called when the gyroscope sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name| Type| Description|
| -------- | -------- | -------- |
| x | number | Rotation angular velocity of the X axis.|
| y | number | Rotation angular velocity of the Y axis.|
| z | number | Rotation angular velocity of the Z axis.|
| Name | Type | Description |
| ---- | ------ | ---------------------------------------- |
| x | number | Rotation angular velocity of the X axis. |
| y | number | Rotation angular velocity of the Y axis. |
| z | number | Rotation angular velocity of the Z axis. |
**Example**
......
......@@ -32,7 +32,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.6.1.4 "><p id="p969714591338"><a name="p969714591338"></a><a name="p969714591338"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="35.76%" headers="mcps1.1.6.1.5 "><p id="p196974598338"><a name="p196974598338"></a><a name="p196974598338"></a>Dynamic modification is not supported. If this attribute is not set, capsule-like buttons are displayed. Different from the capsule button, the four rounded corners of a capsule-like button can be configured using <strong id="b14306174652119"><a name="b14306174652119"></a><a name="b14306174652119"></a>border-radius</strong>. Available button types are as follows:</p>
<a name="ul16971659103317"></a><a name="ul16971659103317"></a><ul id="ul16971659103317"><li><strong id="b2068317502142"><a name="b2068317502142"></a><a name="b2068317502142"></a>capsule</strong>: a capsule button with fillets, background color, and text</li><li><strong id="b13498122171611"><a name="b13498122171611"></a><a name="b13498122171611"></a>circle</strong>: a circle button which can be used to place icons</li><li><strong id="b17405113184910"><a name="b17405113184910"></a><a name="b17405113184910"></a>text</strong>: a text button which displays the text only</li><li><strong id="b1654481619215"><a name="b1654481619215"></a><a name="b1654481619215"></a>arc</strong>: an arc button. This value is applicable to wearables only.</li><li><strong id="b49041951132"><a name="b49041951132"></a><a name="b49041951132"></a>download</strong>: a download button. The download progress bar is added. This value is applicable to smart TVs and smartphones.</li></ul>
<a name="ul16971659103317"></a><a name="ul16971659103317"></a><ul id="ul16971659103317"><li><strong id="b2068317502142"><a name="b2068317502142"></a><a name="b2068317502142"></a>capsule</strong>: a capsule button with fillets, background color, and text</li><li><strong id="b13498122171611"><a name="b13498122171611"></a><a name="b13498122171611"></a>circle</strong>: a circle button which can be used to place icons</li><li><strong id="b17405113184910"><a name="b17405113184910"></a><a name="b17405113184910"></a>text</strong>: a text button which displays the text only</li><li><strong id="b1654481619215"><a name="b1654481619215"></a><a name="b1654481619215"></a>arc</strong>: an arc button. This value is applicable to wearables only.</li><li><strong id="b49041951132"><a name="b49041951132"></a><a name="b49041951132"></a>download</strong>: a download button. The download progress bar is added. </li></ul>
</td>
</tr>
<tr id="row6883454133320"><td class="cellrowborder" valign="top" width="23.119999999999997%" headers="mcps1.1.6.1.1 "><p id="p6698195910338"><a name="p6698195910338"></a><a name="p6698195910338"></a>value</p>
......
......@@ -72,7 +72,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
<td class="cellrowborder" valign="top" width="35.76%" headers="mcps1.1.6.1.5 "><p id="p1455632813277"><a name="p1455632813277"></a><a name="p1455632813277"></a>Data structures used by <strong id="b1997913981710"><a name="b1997913981710"></a><a name="b1997913981710"></a>progress</strong>, <strong id="b991191118176"><a name="b991191118176"></a><a name="b991191118176"></a>loading</strong>, and <strong id="b962820295179"><a name="b962820295179"></a><a name="b962820295179"></a>rainbow</strong> charts.</p>
<p id="p19327195813510"><a name="p19327195813510"></a><a name="p19327195813510"></a><strong id="b196601530164710"><a name="b196601530164710"></a><a name="b196601530164710"></a>DataSegment</strong> is available for <strong id="b1066083012472"><a name="b1066083012472"></a><a name="b1066083012472"></a>progress</strong> and <strong id="b16660143054719"><a name="b16660143054719"></a><a name="b16660143054719"></a>loading</strong> charts.</p>
<p id="p14326258457"><a name="p14326258457"></a><a name="p14326258457"></a><strong id="b1044023344716"><a name="b1044023344716"></a><a name="b1044023344716"></a>Array&lt;<a href="#table2596183616210">DataSegment</a>&gt;</strong> is available for <strong id="b194405335477"><a name="b194405335477"></a><a name="b194405335477"></a>rainbow</strong> charts. A maximum of nine <strong id="b15441133114716"><a name="b15441133114716"></a><a name="b15441133114716"></a>DataSegment</strong> are supported in the array.</p>
<div class="note" id="note74451328478"><a name="note74451328478"></a><a name="note74451328478"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p1744552174711"><a name="p1744552174711"></a><a name="p1744552174711"></a>This attribute is only supported on phones and tablets.</p>
<div class="note" id="note74451328478"><a name="note74451328478"></a><a name="note74451328478"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p1744552174711"><a name="p1744552174711"></a><a name="p1744552174711"></a></p>
</div></div>
</td>
</tr>
......@@ -85,7 +85,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.6.1.4 "><p id="p1820820719229"><a name="p1820820719229"></a><a name="p1820820719229"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="35.76%" headers="mcps1.1.6.1.5 "><p id="p92085712225"><a name="p92085712225"></a><a name="p92085712225"></a>Whether to enable the effects for <strong id="b7262163754711"><a name="b7262163754711"></a><a name="b7262163754711"></a>progress</strong> and <strong id="b12263437134715"><a name="b12263437134715"></a><a name="b12263437134715"></a>rainbow</strong> charts.</p>
<div class="note" id="note15640931164717"><a name="note15640931164717"></a><a name="note15640931164717"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p2064014318476"><a name="p2064014318476"></a><a name="p2064014318476"></a>This attribute is only supported on phones and tablets.</p>
<div class="note" id="note15640931164717"><a name="note15640931164717"></a><a name="note15640931164717"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p2064014318476"><a name="p2064014318476"></a><a name="p2064014318476"></a></p>
</div></div>
</td>
</tr>
......@@ -98,7 +98,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.6.1.4 "><p id="p6133256124018"><a name="p6133256124018"></a><a name="p6133256124018"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="35.76%" headers="mcps1.1.6.1.5 "><p id="p181331564408"><a name="p181331564408"></a><a name="p181331564408"></a>Animation duration for expanding a <strong id="b538918433184"><a name="b538918433184"></a><a name="b538918433184"></a>rainbow</strong> chart, in milliseconds.</p>
<div class="note" id="note12117134774716"><a name="note12117134774716"></a><a name="note12117134774716"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p12117124720471"><a name="p12117124720471"></a><a name="p12117124720471"></a>This attribute is only supported on phones and tablets.</p>
<div class="note" id="note12117134774716"><a name="note12117134774716"></a><a name="note12117134774716"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p12117124720471"><a name="p12117124720471"></a><a name="p12117124720471"></a></p>
</div></div>
</td>
</tr>
......
......@@ -225,8 +225,8 @@ Date selector \(**type** is **date**\)
</td>
<td class="cellrowborder" valign="top" width="7.15%" headers="mcps1.1.6.1.4 "><p id="p1181663281714"><a name="p1181663281714"></a><a name="p1181663281714"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="49.410000000000004%" headers="mcps1.1.6.1.5 "><p id="p781663212178"><a name="p781663212178"></a><a name="p781663212178"></a>Whether to display the lunar calendar switch in the date selector. When this switch is displayed, you can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar. This attribute is available for smartphones.</p>
<div class="note" id="note1688512355211"><a name="note1688512355211"></a><a name="note1688512355211"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p488582345212"><a name="p488582345212"></a><a name="p488582345212"></a>This attribute is only supported on phones and tablets.</p>
<td class="cellrowborder" valign="top" width="49.410000000000004%" headers="mcps1.1.6.1.5 "><p id="p781663212178"><a name="p781663212178"></a><a name="p781663212178"></a>Whether to display the lunar calendar switch in the date selector. When this switch is displayed, you can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar. </p>
<div class="note" id="note1688512355211"><a name="note1688512355211"></a><a name="note1688512355211"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p488582345212"><a name="p488582345212"></a><a name="p488582345212"></a></p>
</div></div>
</td>
</tr>
......@@ -293,8 +293,8 @@ Date and time selector \(**type** is **datetime**\)
</td>
<td class="cellrowborder" valign="top" width="7.15%" headers="mcps1.1.6.1.4 "><p id="p16203115101819"><a name="p16203115101819"></a><a name="p16203115101819"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="49.410000000000004%" headers="mcps1.1.6.1.5 "><p id="p12203111510184"><a name="p12203111510184"></a><a name="p12203111510184"></a>Whether to display the lunar calendar switch in the date and time selector. When this switch is displayed, you can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar. This attribute is available for smartphones.</p>
<div class="note" id="note11541837195218"><a name="note11541837195218"></a><a name="note11541837195218"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p454119371529"><a name="p454119371529"></a><a name="p454119371529"></a>This attribute is only supported on phones and tablets.</p>
<td class="cellrowborder" valign="top" width="49.410000000000004%" headers="mcps1.1.6.1.5 "><p id="p12203111510184"><a name="p12203111510184"></a><a name="p12203111510184"></a>Whether to display the lunar calendar switch in the date and time selector. When this switch is displayed, you can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar. </p>
<div class="note" id="note11541837195218"><a name="note11541837195218"></a><a name="note11541837195218"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p454119371529"><a name="p454119371529"></a><a name="p454119371529"></a>
</div></div>
</td>
</tr>
......@@ -424,7 +424,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
<td class="cellrowborder" valign="top" width="5.909409059094091%" headers="mcps1.1.6.1.4 "><p id="p10494123164013"><a name="p10494123164013"></a><a name="p10494123164013"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="40.01599840015999%" headers="mcps1.1.6.1.5 "><p id="p20494323144012"><a name="p20494323144012"></a><a name="p20494323144012"></a>Font color of the items that gradually disappear. Disappearing items are the top option and bottom option of a column containing five options in total.</p>
<div class="note" id="note682125718522"><a name="note682125718522"></a><a name="note682125718522"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p17821185711521"><a name="p17821185711521"></a><a name="p17821185711521"></a>This attribute is only supported on phones and tablets.</p>
<div class="note" id="note682125718522"><a name="note682125718522"></a><a name="note682125718522"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p17821185711521"><a name="p17821185711521"></a><a name="p17821185711521"></a></p>
</div></div>
</td>
</tr>
......@@ -437,7 +437,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
<td class="cellrowborder" valign="top" width="5.909409059094091%" headers="mcps1.1.6.1.4 "><p id="p1949522364020"><a name="p1949522364020"></a><a name="p1949522364020"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="40.01599840015999%" headers="mcps1.1.6.1.5 "><p id="p1549532364020"><a name="p1549532364020"></a><a name="p1549532364020"></a>Font size of the items that gradually disappear. Disappearing items are the top option and bottom option of a column containing five options in total.</p>
<div class="note" id="note17211975317"><a name="note17211975317"></a><a name="note17211975317"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p1821895535"><a name="p1821895535"></a><a name="p1821895535"></a>This attribute is only supported on phones and tablets.</p>
<div class="note" id="note17211975317"><a name="note17211975317"></a><a name="note17211975317"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p1821895535"><a name="p1821895535"></a><a name="p1821895535"></a></p>
</div></div>
</td>
</tr>
......
......@@ -178,7 +178,7 @@ When **type** is set to **date**, a date selector is used.
<td class="cellrowborder" valign="top" width="7.15%" headers="mcps1.1.6.1.4 "><p id="p20878141062610"><a name="p20878141062610"></a><a name="p20878141062610"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="49.410000000000004%" headers="mcps1.1.6.1.5 "><p id="p9878910132617"><a name="p9878910132617"></a><a name="p9878910132617"></a>Whether the date selector displays the lunar calendar switch, which is used to switch between the Gregorian calendar and lunar calendar. The value <strong id="b1242195251513"><a name="b1242195251513"></a><a name="b1242195251513"></a>true</strong> means to display the lunar calendar switch for users to switch between the Gregorian calendar and lunar calendar. The value <strong id="b729391317186"><a name="b729391317186"></a><a name="b729391317186"></a>false</strong> means not to display the lunar calendar switch.</p>
<div class="note" id="note799016359510"><a name="note799016359510"></a><a name="note799016359510"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p49901135165115"><a name="p49901135165115"></a><a name="p49901135165115"></a>This attribute is only supported on phones and tablets. When both <strong id="b66411209185"><a name="b66411209185"></a><a name="b66411209185"></a>lunarswitch</strong> and <strong id="b1364102010185"><a name="b1364102010185"></a><a name="b1364102010185"></a>lunar</strong> are set to <strong id="b665102015187"><a name="b665102015187"></a><a name="b665102015187"></a>true</strong>, the switch is selected.</p>
<div class="note" id="note799016359510"><a name="note799016359510"></a><a name="note799016359510"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p49901135165115"><a name="p49901135165115"></a><a name="p49901135165115"></a> When both <strong id="b66411209185"><a name="b66411209185"></a><a name="b66411209185"></a>lunarswitch</strong> and <strong id="b1364102010185"><a name="b1364102010185"></a><a name="b1364102010185"></a>lunar</strong> are set to <strong id="b665102015187"><a name="b665102015187"></a><a name="b665102015187"></a>true</strong>, the switch is selected.</p>
</div></div>
</td>
</tr>
......@@ -329,7 +329,7 @@ When **type** is set to **datetime**, a date and time selector is used.
<td class="cellrowborder" valign="top" width="7.15%" headers="mcps1.1.6.1.4 "><p id="p12312856141615"><a name="p12312856141615"></a><a name="p12312856141615"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="49.410000000000004%" headers="mcps1.1.6.1.5 "><p id="p134738505123"><a name="p134738505123"></a><a name="p134738505123"></a>Whether the date selector displays the lunar calendar switch, which is used to switch between the Gregorian calendar and lunar calendar. The value <strong id="b11888837151819"><a name="b11888837151819"></a><a name="b11888837151819"></a>true</strong> means to display the lunar calendar switch for users to switch between the Gregorian calendar and lunar calendar. The value <strong id="b454518384186"><a name="b454518384186"></a><a name="b454518384186"></a>false</strong> means not to display the lunar calendar switch.</p>
<div class="note" id="note5428114735118"><a name="note5428114735118"></a><a name="note5428114735118"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p1342819474512"><a name="p1342819474512"></a><a name="p1342819474512"></a>This attribute is only supported on phones and tablets. When both <strong id="b57802039111819"><a name="b57802039111819"></a><a name="b57802039111819"></a>lunarswitch</strong> and <strong id="b18781153991810"><a name="b18781153991810"></a><a name="b18781153991810"></a>lunar</strong> are set to <strong id="b4781173931813"><a name="b4781173931813"></a><a name="b4781173931813"></a>true</strong>, the switch is selected.</p>
<div class="note" id="note5428114735118"><a name="note5428114735118"></a><a name="note5428114735118"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p1342819474512"><a name="p1342819474512"></a><a name="p1342819474512"></a>When both <strong id="b57802039111819"><a name="b57802039111819"></a><a name="b57802039111819"></a>lunarswitch</strong> and <strong id="b18781153991810"><a name="b18781153991810"></a><a name="b18781153991810"></a>lunar</strong> are set to <strong id="b4781173931813"><a name="b4781173931813"></a><a name="b4781173931813"></a>true</strong>, the switch is selected.</p>
</div></div>
</td>
</tr>
......@@ -529,7 +529,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
<td class="cellrowborder" valign="top" width="8.60913908609139%" headers="mcps1.1.6.1.4 "><p id="p1862185217363"><a name="p1862185217363"></a><a name="p1862185217363"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="52.274772522747725%" headers="mcps1.1.6.1.5 "><p id="p116215526369"><a name="p116215526369"></a><a name="p116215526369"></a>Height of the selector option list.</p>
<div class="note" id="note769381335220"><a name="note769381335220"></a><a name="note769381335220"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p18693101311524"><a name="p18693101311524"></a><a name="p18693101311524"></a>This attribute is only supported on phones and tablets.</p>
<div class="note" id="note769381335220"><a name="note769381335220"></a><a name="note769381335220"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p18693101311524"><a name="p18693101311524"></a><a name="p18693101311524"></a></p>
</div></div>
</td>
</tr>
......
......@@ -58,7 +58,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.6.1.4 "><p id="p5738613465"><a name="p5738613465"></a><a name="p5738613465"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="35.76%" headers="mcps1.1.6.1.5 "><p id="p27381813364"><a name="p27381813364"></a><a name="p27381813364"></a>Step to increment the rating value.</p>
<div class="note" id="note1249472985312"><a name="note1249472985312"></a><a name="note1249472985312"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p749462910531"><a name="p749462910531"></a><a name="p749462910531"></a>This attribute is only supported on phones and tablets.</p>
<div class="note" id="note1249472985312"><a name="note1249472985312"></a><a name="note1249472985312"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p749462910531"><a name="p749462910531"></a><a name="p749462910531"></a></p>
</div></div>
</td>
</tr>
......
......@@ -76,7 +76,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.6.1.4 "><p id="p23951632105213"><a name="p23951632105213"></a><a name="p23951632105213"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="35.76%" headers="mcps1.1.6.1.5 "><p id="p83958323527"><a name="p83958323527"></a><a name="p83958323527"></a>Slider style. Available values are as follows:</p>
<a name="ul742810911538"></a><a name="ul742810911538"></a><ul id="ul742810911538"><li><strong id="b6310165918435"><a name="b6310165918435"></a><a name="b6310165918435"></a>outset</strong>: The slider is on the sliding bar.</li><li><strong id="b144297112440"><a name="b144297112440"></a><a name="b144297112440"></a>inset</strong>: The slider is inside the sliding bar.<div class="note" id="note10509152215419"><a name="note10509152215419"></a><a name="note10509152215419"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p14509172218549"><a name="p14509172218549"></a><a name="p14509172218549"></a>This attribute is only supported on phones and tablets.</p>
<a name="ul742810911538"></a><a name="ul742810911538"></a><ul id="ul742810911538"><li><strong id="b6310165918435"><a name="b6310165918435"></a><a name="b6310165918435"></a>outset</strong>: The slider is on the sliding bar.</li><li><strong id="b144297112440"><a name="b144297112440"></a><a name="b144297112440"></a>inset</strong>: The slider is inside the sliding bar.<div class="note" id="note10509152215419"><a name="note10509152215419"></a><a name="note10509152215419"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p14509172218549"><a name="p14509172218549"></a><a name="p14509172218549"></a></p>
</div></div>
</li></ul>
</td>
......@@ -90,7 +90,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.6.1.4 "><p id="p1139593235218"><a name="p1139593235218"></a><a name="p1139593235218"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="35.76%" headers="mcps1.1.6.1.5 "><p id="p639683265217"><a name="p639683265217"></a><a name="p639683265217"></a>Whether to display slider scales.</p>
<div class="note" id="note8765635135413"><a name="note8765635135413"></a><a name="note8765635135413"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p576523535418"><a name="p576523535418"></a><a name="p576523535418"></a>This attribute is only supported on phones and tablets.</p>
<div class="note" id="note8765635135413"><a name="note8765635135413"></a><a name="note8765635135413"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p576523535418"><a name="p576523535418"></a><a name="p576523535418"></a></p>
</div></div>
</td>
</tr>
......@@ -103,7 +103,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.6.1.4 "><p id="p123962032185210"><a name="p123962032185210"></a><a name="p123962032185210"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="35.76%" headers="mcps1.1.6.1.5 "><p id="p16396133212520"><a name="p16396133212520"></a><a name="p16396133212520"></a>Whether a pop-up is displayed to show the percentage value on the slider.</p>
<div class="note" id="note0708645135419"><a name="note0708645135419"></a><a name="note0708645135419"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p4708154510548"><a name="p4708154510548"></a><a name="p4708154510548"></a>This attribute is only supported on phones and tablets.</p>
<div class="note" id="note0708645135419"><a name="note0708645135419"></a><a name="note0708645135419"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p4708154510548"><a name="p4708154510548"></a><a name="p4708154510548"></a></p>
</div></div>
</td>
</tr>
......@@ -158,7 +158,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
<td class="cellrowborder" valign="top" width="15.578442155784424%" headers="mcps1.1.6.1.4 "><p id="p3970121745715"><a name="p3970121745715"></a><a name="p3970121745715"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="31.95680431956805%" headers="mcps1.1.6.1.5 "><p id="p12970817175710"><a name="p12970817175710"></a><a name="p12970817175710"></a>Slider color.</p>
<div class="note" id="note29562075516"><a name="note29562075516"></a><a name="note29562075516"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p7956203555"><a name="p7956203555"></a><a name="p7956203555"></a>This attribute is only supported on phones, tablets, and wearables.</p>
<div class="note" id="note29562075516"><a name="note29562075516"></a><a name="note29562075516"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p7956203555"><a name="p7956203555"></a><a name="p7956203555"></a></p>
</div></div>
</td>
</tr>
......
......@@ -92,7 +92,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.1.6.1.4 "><p id="p11802185153615"><a name="p11802185153615"></a><a name="p11802185153615"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="35.76%" headers="mcps1.1.6.1.5 "><p id="p118021351362"><a name="p118021351362"></a><a name="p118021351362"></a>Pull-down friction coefficient. The value ranges from <strong id="b7887020335"><a name="b7887020335"></a><a name="b7887020335"></a>0</strong> to <strong id="b81365257313"><a name="b81365257313"></a><a name="b81365257313"></a>100</strong>. A larger value indicates a more responsive component. For example, if a user pulls the component down 100 px, it will actually move 100 * <strong id="b2130757132018"><a name="b2130757132018"></a><a name="b2130757132018"></a>friction</strong>% px.</p>
<div class="note" id="note204304260349"><a name="note204304260349"></a><a name="note204304260349"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p1343012264345"><a name="p1343012264345"></a><a name="p1343012264345"></a>This attribute is only supported on phones, tablets, and wearables.</p>
<div class="note" id="note204304260349"><a name="note204304260349"></a><a name="note204304260349"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p1343012264345"><a name="p1343012264345"></a><a name="p1343012264345"></a></p>
</div></div>
</td>
</tr>
......
......@@ -43,7 +43,7 @@ export default {
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**:
> - To make the array data modification take effect, use the splice method to change array items.
>
>
> - ECMAScript 6 (ES6) syntax is not supported in HML.
......@@ -58,7 +58,7 @@ Events can be written in the following formats:
- funcName(a,b): function parameters, such as a and b, which can be constants, or variables defined in data in the .js file. Do not add the prefix this. to variables.
- Example
```
<!-- xxx.hml -->
<div class="container">
......@@ -74,7 +74,7 @@ Events can be written in the following formats:
</div>
```
```
// xxx.js
export default {
......@@ -93,7 +93,7 @@ Events can be written in the following formats:
};
```
```
/* xxx.css */
.container {
......@@ -139,7 +139,7 @@ Bubbling event binding covers the following:
> For details about bubbling events, see [Universal Events](../reference/arkui-js/js-components-common-events.md)
- Example
```
<!-- xxx.hml -->
<div>
......@@ -157,8 +157,8 @@ Bubbling event binding covers the following:
<div grab:click="clickfunc"></div>
</div>
```
```
// xxx.js
export default {
......@@ -185,7 +185,7 @@ Event capturing binding includes:
- Bind an event callback, but stop the event from being captured during downward transfer: grab:{event}.capture.
- Example
```
<!-- xxx.hml -->
<div>
......@@ -195,7 +195,7 @@ Event capturing binding includes:
</div>
```
```
// xxx.js
export default {
......@@ -262,9 +262,9 @@ The for loop supports the following statements:
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**:
> - Each element in the array must have the data attribute specified by tid. Otherwise, an exception may occur.
>
>
> - The attribute specified by tid in the array must be unique. Otherwise, performance loss occurs. In the above example, only id and name can be used as tid because they are unique fields.
>
>
> - The tid field does not support expressions.
......@@ -278,8 +278,8 @@ There are two ways to implement conditional rendering: if-elif-else or show. In
<div class="container">
<button class="btn" type="capsule" value="toggleShow" onclick="toggleShow"></button>
<button class="btn" type="capsule" value="toggleDisplay" onclick="toggleDisplay"></button>
<text if="{{visible}}"> Hello-TV </text>
<text elif="{{display}}"> Hello-Wearable </text>
<text if="{{visible}}"> Hello-World1 </text>
<text elif="{{display}}"> Hello-World2 </text>
<text else> Hello-World </text>
</div>
```
......
......@@ -11,7 +11,7 @@ Custom components decorated by @Preview can be previewed in the Previewer of Dev
Example of using @Preview:
```
// Display only Hello Component1 on the PC preview. The content under MyComponent is displayed on the real device.
// Display only Hello Component1 on the preview. The content under MyComponent is displayed on the real device.
@Entry
@Component
struct MyComponent {
......
......@@ -39,7 +39,7 @@ Create a &lt;list&gt; component in the .hml file under pages/index.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**:
> - &lt;list-item-group&gt; is a child component of the &lt;list&gt; component and is used to group items in a list. It can have a &lt;list-item&gt; nested inside, but not &lt;list&gt;.
>
>
> - &lt;list-item&gt; is a child component of the &lt;list&gt; component and is used to display items in a list.
......@@ -116,7 +116,7 @@ Set a custom indexer component to add an index bar at the right boundary of a li
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**:
> - This indexer attribute is valid only when flex-direction is set to column and columns is set to 1.
>
>
> - You must include "\#" when using a customized indexer.
......@@ -219,7 +219,7 @@ Search for contacts by using an alphabetical indexer.
<div class="container">
<div class="in-container">
<text class="name">{{$item.name}}</text>
<text class="phone">18888888888</text>
<text class="number">18888888888</text>
</div>
</div>
</list-item>
......@@ -251,7 +251,7 @@ Search for contacts by using an alphabetical indexer.
color: #000000;
font-size: 39px;
}
.phone {
.number {
color: black;
font-size: 25px;
}
......
......@@ -72,9 +72,8 @@ export default {
![en-us_image_0000001267647893](figures/en-us_image_0000001267647893.gif)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**:
> - When setting the value range of a common selector, you must use the data binding mode.
>
> - The lunarswitch attribute of the date selector is only supported on phones and tablets.
>
> When setting the value range of a common selector, you must use the data binding mode.
## Setting the Time Format
......@@ -110,7 +109,7 @@ Set the hours attribute to specify the time format used by the time selector. Av
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**:
> - When hours is set to 12, the time is displayed in 12-hour format and distinguished by a.m. and p.m.
>
>
> - When hours is set to 24, the time is displayed in 24-hour format.
......
......@@ -13,7 +13,7 @@ On the created page, we use various items to describe food, such as food names,
2. Define a food data storage model, FoodData, and an enum variable, Category. The FoodData class contains the food ID, name, category, image, calories, protein, fat, carbohydrates, and vitamin C attributes.
The eTS programming language is an extension of the TS language and also supports the TS syntax.
```
enum Category {
Fruit,
......@@ -22,7 +22,7 @@ On the created page, we use various items to describe food, such as food names,
Seafood,
Dessert
}
let NextId = 0;
class FoodData {
id: string;
......@@ -34,7 +34,7 @@ On the created page, we use various items to describe food, such as food names,
fat: number;
carbohydrates: number;
vitaminC: number;
constructor(name: string, image: Resource, category: Category, calories: number, protein: number, fat: number, carbohydrates: number, vitaminC: number) {
this.id = `${ NextId++ }`;
this.name = name;
......@@ -49,13 +49,13 @@ On the created page, we use various items to describe food, such as food names,
}
```
3. Store food image resources in the resources > phone > media directory. Use food names as the image names.
3. Store food image resources in the resources > base > media directory. Use food names as the image names.
4. Create food resource data. Create FoodDataModels.ets in the model folder and declare a food composition array, FoodComposition on the page.
In this example, you can customize more data resources when needed. Use LazyForEach to load data if a large amount of food data is involved.
5. Create the initializeOnStartUp method to initialize the FoodData array. Export the FoodData class from FoodData.ets, and import FoodData and Category in FoodDataModels.ets.
```
// FoodData.ets
export enum Category {
......@@ -66,7 +66,7 @@ On the created page, we use various items to describe food, such as food names,
}
// FoodDataModels.ets
import { Category, FoodData } from './FoodData'
export function initializeOnStartup(): Array<FoodData> {
let FoodDataArray: Array<FoodData> = []
FoodComposition.forEach(item => {
......
......@@ -7,8 +7,8 @@ Before creating a project, you need to install DevEco Studio.
1. Open DevEco Studio and click Create Project. If there is already a project, choose File > New > New project.
![en-us_image_0000001267607861](figures/en-us_image_0000001267607861.png)
2.
2.
On the page for selecting an ability template, select [Standard]Empty Ability.
......@@ -20,13 +20,13 @@ Before creating a project, you need to install DevEco Studio.
![en-us_image_0000001223127700](figures/en-us_image_0000001223127700.png)
4. On the project configuration page, set Project Name to HealthyDiet, Project Type to Application, Device Type to Phone, Language to eTS, and Compatible API Version to SDK: API Version 7. By default, DevEco Studio saves the project to drive C. You can change the save path by setting Save Location. When you are done, click Finish.
![en-us_image_0000001267647849](figures/en-us_image_0000001267647849.png)
5. After the project is created, open the app.ets file.
The app.ets file provides the onCreate and onDestroy methods for the application lifecycle. onCreate is called when an application is created, and onDestroy is called when an application is destroyed. Global variables can be declared in the app.ets file, wherein the declared data and methods are shared by the entire application.
```
export default {
onCreate() {
......@@ -39,7 +39,7 @@ Before creating a project, you need to install DevEco Studio.
```
6. In the project navigation tree, open index.ets. This page displays the current UI description. The declarative UI framework automatically generates a component-based struct, which complies with the Builder API declaration. The current layout and components are declared in the build method.
```
@Entry
@Component
......@@ -56,14 +56,14 @@ Before creating a project, you need to install DevEco Studio.
}
```
7. Click Previewer on the right to open the Previewer window. In the Previewer window of the phone type, Hello World is displayed in the middle and in bold.
7. Click Previewer on the right to open the Previewer window. Hello World is displayed in the middle and in bold.
If the Previewer button is unavailable, choose Settings > SDK Manager >OpenHarmony SDK > Tools to check whether the Previewer is installed.
![en-us_image_0000001222807756](figures/en-us_image_0000001222807756.png)
8. Install the application on the phone and run the application. Connect the phone to the computer. After the IDE identifies the phone, click Run'entry'.
8. Install the application and run the application. Connect the device to the computer. After the IDE identifies the device, click Run'entry'.
![en-us_image_0000001267607865](figures/en-us_image_0000001267607865.png)
Before the installation, you must configure an application signature. For details, see [Configuring the OpenHarmony App Signature](../quick-start/configuring-the-openharmony-app-signature.md). After the installation is complete, click the Run icon on the screen to open the application. Hello World is displayed in the center of the screen.
Before the installation, you must configure an application signature. For details, see Configuring the OpenHarmony App Signature. After the installation is complete, click the Run icon on the screen to open the application. Hello World is displayed in the center of the screen.
![en-us_image_0000001267647841](figures/en-us_image_0000001267647841.png)
......@@ -46,13 +46,7 @@ In this section, we will develop an infographic food details page, by building c
![en-us_image_0000001267887861](figures/en-us_image_0000001267887861.png)
3. Access images through resources.
In addition to specifying the image path, you can also use the media resource symbol $r to reference resources based on the resource qualifier rules in the resources folder. Right-click the resources folder, choose New &gt; Resource Directory, set Resource Type to Media (image resource), and set the resource qualifier to Device-Phone (currently, phones are used).
![en-us_image_0000001267887853](figures/en-us_image_0000001267887853.png)
Click OK. The phone.media folder is generated in the resources folder. Place Tomato.png in the folder.
![en-us_image_0000001222807784](figures/en-us_image_0000001222807784.png)
In addition to specifying the image path, you can also use the media resource symbol $r to reference resources based on the resource qualifier rules in the resources folder. Right-click the resources folder, choose New &gt; Resource Directory, set Resource Type to Media (image resource).Place Tomato.png in the media folder.
You can then can reference the application resource in the ` "$r('app.type.name')"` format, that is, `$r('app.media.Tomato')`.
......
......@@ -20,7 +20,7 @@ The declarative UI paradigm provides two mechanisms for page redirection:
The procedure below uses these two mechanisms for redirection between the page list page and food details page.
1. Click FoodListItem. The FoodDetail page is displayed. Create a Navigator component in FoodListItem to enable its child components to have the routing function. The target page is 'pages/FoodDetail'.
```
@Component
struct FoodListItem {
......@@ -50,10 +50,10 @@ The procedure below uses these two mechanisms for redirection between the page l
![en-us_image_0000001223127744](figures/en-us_image_0000001223127744.gif)
2. Click FoodGridItem. The FoodDetail page is displayed. Import the router module, and then call the push API of this module to push the FoodDetail page to the route stack to implement page redirection.
```
import router from '@system.router'
@Component
struct FoodGridItem {
private foodItem: FoodData
......@@ -72,12 +72,12 @@ The procedure below uses these two mechanisms for redirection between the page l
![en-us_image_0000001267607909](figures/en-us_image_0000001267607909.gif)
3. Add the icon for returning from the FoodDetail page to the food list page. Save the Back.png file to the resources > phone > media directory. Create a custom component PageTitle, which contains the back icon and Food Detail text. Call the router.back() API of the router to display the top page of the route stack, that is, the upper-level page.
3. Add the icon for returning from the FoodDetail page to the food list page. Save the Back.png file to the resources > base > media directory. Create a custom component PageTitle, which contains the back icon and Food Detail text. Call the router.back() API of the router to display the top page of the route stack, that is, the upper-level page.
```
// FoodDetail.ets
import router from '@system.router'
@Component
struct PageTitle {
build() {
......@@ -100,7 +100,7 @@ The procedure below uses these two mechanisms for redirection between the page l
```
4. Create the Stack component in the FoodDetail component, including the FoodImageDisplay and PageTitle child components. Set the alignment mode to TopStart.
```
@Entry
@Component
......@@ -126,7 +126,7 @@ The procedure below uses these two mechanisms for redirection between the page l
We have implemented the redirection and going back of the FoodCategoryList and FoodDetail pages. At this point, the tomato details page is displayed no matter which FoodListItem/FoodGridItem is clicked. This is because the data transmission between pages is not yet configured. To configure data transmission between pages, set the routing with parameters as follows:
1. Set the params attribute in the Navigator of the FoodListItem component. The params attribute accepts the key-value object.
```
// FoodList.ets
@Component
......@@ -143,7 +143,7 @@ We have implemented the redirection and going back of the FoodCategoryList and F
The router API called by FoodGridItem also has the capability of redirection with parameters. The method of using the router API is similar to that of using the Navigator.
```
router.push({
uri: 'pages/FoodDetail',
......@@ -152,11 +152,11 @@ We have implemented the redirection and going back of the FoodCategoryList and F
```
2. Import the FoodData class to the FoodDetail page and add the foodItem member variable to the FoodDetail component.
```
// FoodDetail.ets
import { FoodData } from '../model/FoodData'
@Entry
@Component
struct FoodDetail {
......@@ -168,13 +168,13 @@ We have implemented the redirection and going back of the FoodCategoryList and F
```
3. Obtain the value of foodData. Call router.getParams().foodData to obtain the data corresponding to foodData carried when the FoodCategoryList page is displayed.
```
@Entry
@Component
struct FoodDetail {
private foodItem: FoodData = router.getParams().foodData
build() {
......
}
......@@ -182,7 +182,7 @@ We have implemented the redirection and going back of the FoodCategoryList and F
```
4. Re-build the components on the FoodDetail page. During building, the food information on the FoodDetail page is all directly declared constants. You need to use the passed FoodData data to assign a new value to the constants. The code is as follows:
```
@Component
struct PageTitle {
......@@ -203,7 +203,7 @@ We have implemented the redirection and going back of the FoodCategoryList and F
})
}
}
@Component
struct FoodImageDisplay {
private foodItem: FoodData
......@@ -220,11 +220,11 @@ We have implemented the redirection and going back of the FoodCategoryList and F
.backgroundColor('#FFedf2f5')
}
}
@Component
struct ContentTable {
private foodItem: FoodData
@Builder IngredientItem(title:string, name: string, value: string) {
Flex() {
Text(title)
......@@ -241,7 +241,7 @@ We have implemented the redirection and going back of the FoodCategoryList and F
.layoutWeight(2)
}
}
build() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Start }) {
this.IngredientItem('Calories', 'Calories', this.foodItem.calories + 'kcal')
......@@ -254,12 +254,12 @@ We have implemented the redirection and going back of the FoodCategoryList and F
.padding({ top: 30, right: 30, left: 30 })
}
}
@Entry
@Component
struct FoodDetail {
private foodItem: FoodData = router.getParams().foodData
build() {
Column() {
Stack( { alignContent: Alignment.TopStart }) {
......
......@@ -220,6 +220,10 @@
- Distributed Call Chain Tracing
- [Overview of Distributed Call Chain Tracing](dfx/hitracechain-overview.md)
- [Development of Distributed Call Chain Tracing](dfx/hitracechain-guidelines.md)
- Internationalization
- [Overview](internationalization/international-overview.md)
- [Internationalization Development (intl)](internationalization/intl-guidelines.md)
- [Internationalization Development (i18n)](internationalization/i18n-guidelines.md)
- Tools
- [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md)
- Hands-On Tutorials
......@@ -475,7 +479,7 @@
- [Built-in Enums](reference/arkui-ts/ts-appendix-enums.md)
- APIs
- Ability Framework
- [@ohos.ability.dataUriUtils](reference/apis/js-apis-DataUriUtils.md)
- [@ohos.ability.errorCode ](reference/apis/js-apis-ability-errorcode.md)
- [@ohos.ability.wantConstant](reference/apis/js-apis-ability-wantConstant.md)
......@@ -519,65 +523,65 @@
- [ProcessRunningInfo](reference/apis/js-apis-processrunninginfo.md)
- [ServiceExtensionContext](reference/apis/js-apis-service-extension-context.md)
- [shellCmdResult](reference/apis/js-apis-application-shellCmdResult.md)
- Common Event and Notification
- [@ohos.commonEvent](reference/apis/js-apis-commonEvent.md)
- [@ohos.events.emitter](reference/apis/js-apis-emitter.md)
- [@ohos.notification](reference/apis/js-apis-notification.md)
- [@ohos.reminderAgent](reference/apis/js-apis-reminderAgent.md)
- [EventHub](reference/apis/js-apis-eventhub.md)
- Bundle Management
- [@ohos.bundle](reference/apis/js-apis-Bundle.md)
- [@ohos.bundleState ](reference/apis/js-apis-deviceUsageStatistics.md)
- [@ohos.zlib](reference/apis/js-apis-zlib.md)
- UI Page
- [@ohos.animator](reference/apis/js-apis-animator.md)
- Graphics
- [@ohos.display ](reference/apis/js-apis-display.md)
- [@ohos.screenshot](reference/apis/js-apis-screenshot.md)
- [@ohos.window](reference/apis/js-apis-window.md)
- [webgl](reference/apis/js-apis-webgl.md)
- [webgl2](reference/apis/js-apis-webgl2.md)
- Media
- [@ohos.multimedia.audio](reference/apis/js-apis-audio.md)
- [@ohos.multimedia.camera](reference/apis/js-apis-camera.md)
- [@ohos.multimedia.image](reference/apis/js-apis-image.md)
- [@ohos.multimedia.media](reference/apis/js-apis-media.md)
- [@ohos.multimedia.medialibrary](reference/apis/js-apis-medialibrary.md)
- Resource Management
- [@ohos.i18n](reference/apis/js-apis-i18n.md)
- [@ohos.intl](reference/apis/js-apis-intl.md)
- [@ohos.resourceManager](reference/apis/js-apis-resource-manager.md)
- Resource Scheduling
- [@ohos.backgroundTaskManager](reference/apis/js-apis-backgroundTaskManager.md)
- [@ohos.workScheduler ](reference/apis/js-apis-workScheduler.md)
- [@ohos.WorkSchedulerExtensionAbility](reference/apis/js-apis-WorkSchedulerExtensionAbility.md)
- Custom Management
- [@ohos.configPolicy](reference/apis/js-apis-config-policy.md)
- [@ohos.enterpriseDeviceManager](reference/apis/js-apis-enterprise-device-manager.md)
- Security
- [@ohos.abilityAccessCtrl](reference/apis/js-apis-abilityAccessCtrl.md)
- [@ohos.security.huks ](reference/apis/js-apis-huks.md)
- [@ohos.userIAM.userAuth ](reference/apis/js-apis-useriam-userauth.md)
- Data Management
- [@ohos.data.dataAbility ](reference/apis/js-apis-data-ability.md)
- [@ohos.data.distributedData](reference/apis/js-apis-distributed-data.md)
- [@ohos.data.distributedDataObject](reference/apis/js-apis-data-distributedobject.md)
......@@ -585,18 +589,18 @@
- [@ohos.data.rdb](reference/apis/js-apis-data-rdb.md)
- [@ohos.settings](reference/apis/js-apis-settings.md)
- [resultSet](reference/apis/js-apis-data-resultset.md)
- File Management
- [@ohos.environment](reference/apis/js-apis-environment.md)
- [@ohos.fileio](reference/apis/js-apis-fileio.md)
- [@ohos.fileManager](reference/apis/js-apis-filemanager.md)
- [@ohos.statfs](reference/apis/js-apis-statfs.md)
- [@ohos.storageStatistics](reference/apis/js-apis-storage-statistics.md)
- [@ohos.volumeManager](reference/apis/js-apis-volumemanager.md)
- Telephony Service
- [@ohos.contact](reference/apis/js-apis-contact.md)
- [@ohos.telephony.call](reference/apis/js-apis-call.md)
- [@ohos.telephony.observer](reference/apis/js-apis-observer.md)
......@@ -604,23 +608,23 @@
- [@ohos.telephony.sim](reference/apis/js-apis-sim.md)
- [@ohos.telephony.sms](reference/apis/js-apis-sms.md)
- [@ohos.telephony.data](reference/apis/js-apis-telephony-data.md)
- Network Management
- [@ohos.net.connection](reference/apis/js-apis-net-connection.md)
- [@ohos.net.http](reference/apis/js-apis-http.md)
- [@ohos.request](reference/apis/js-apis-request.md)
- [@ohos.net.socket](reference/apis/js-apis-socket.md)
- [@ohos.net.webSocket](reference/apis/js-apis-webSocket.md)
- Connectivity
- [@ohos.bluetooth](reference/apis/js-apis-bluetooth.md)
- [@ohos.rpc](reference/apis/js-apis-rpc.md)
- [@ohos.wifi](reference/apis/js-apis-wifi.md)
- [@ohos.wifiext](reference/apis/js-apis-wifiext.md)
- Basic Features
- [@ohos.accessibility](reference/apis/js-apis-accessibility.md)
- [@ohos.faultLogger](reference/apis/js-apis-faultLogger.md)
- [@ohos.hiAppEvent](reference/apis/js-apis-hiappevent.md)
......@@ -636,9 +640,9 @@
- [@ohos.systemTime](reference/apis/js-apis-system-time.md)
- [@ohos.wallpaper](reference/apis/js-apis-wallpaper.md)
- [Timer](reference/apis/js-apis-timer.md)
- Device Management
- [@ohos.batteryInfo ](reference/apis/js-apis-battery-info.md)
- [@ohos.brightness](reference/apis/js-apis-brightness.md)
- [@ohos.deviceInfo](reference/apis/js-apis-device-info.md)
......@@ -656,15 +660,15 @@
- [@ohos.update](reference/apis/js-apis-update.md)
- [@ohos.usb](reference/apis/js-apis-usb.md)
- [@ohos.vibrator](reference/apis/js-apis-vibrator.md)
- Account Management
- [@ohos.account.appAccount](reference/apis/js-apis-appAccount.md)
- [@ohos.account.distributedAccount](reference/apis/js-apis-distributed-account.md)
- [@ohos.account.osAccount](reference/apis/js-apis-osAccount.md)
- Language Base Class Library
- [@ohos.convertxml](reference/apis/js-apis-convertxml.md)
- [@ohos.process](reference/apis/js-apis-process.md)
- [@ohos.uri](reference/apis/js-apis-uri.md)
......@@ -686,13 +690,13 @@
- [@ohos.util.Vector](reference/apis/js-apis-vector.md)
- [@ohos.worker](reference/apis/js-apis-worker.md)
- [@ohos.xml](reference/apis/js-apis-xml.md)
- Test
- [@ohos.application.testRunner](reference/apis/js-apis-testRunner.md)
- [@ohos.uitest](reference/apis/js-apis-uitest.md)
- APIs No Longer Maintained
- [@ohos.bytrace](reference/apis/js-apis-bytrace.md)
- [@ohos.data.storage](reference/apis/js-apis-data-storage.md)
- [@system.app](reference/apis/js-apis-system-app.md)
......
......@@ -6,29 +6,29 @@ OpenHarmony系统传感器是应用访问底层硬件传感器的一种设备抽
传感器是指用于侦测环境中所发生事件或变化,并将此消息发送至其他电子设备(如中央处理器)的设备,通常由敏感组件和转换组件组成。传感器是实现物联网智能化的重要基石,为实现全场景智慧化战略,支撑“1+8+N”产品需求,需要构筑统一的传感器管理框架,达到为各产品/业务提供低时延、低功耗的感知数据的目的。下面为传感器列表:
| 传感器类型 | 描述 | 说明 | 主要用途 |
| --------------------------------------- | ------------------ | ------------------------------------------------------------ | ---------------------------------------- |
| SENSOR_TYPE_ACCELEROMETER | 加速度传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,施加在设备上的加速度(包括重力加速度),单位&nbsp;:&nbsp;m/s2 | 检测运动状态 |
| SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED | 未校准加速度传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,施加在设备上的未校准的加速度(包括重力加速度),单位&nbsp;:&nbsp;m/s2 | 检测加速度偏差估值 |
| SENSOR_TYPE_LINEAR_ACCELERATION | 线性加速度传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,施加在设备上的线性加速度(不包括重力加速度),单位&nbsp;:&nbsp;m/s2 | 检测每个单轴方向上的线性加速度 |
| SENSOR_TYPE_GRAVITY | 重力传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,施加在设备上的重力加速度,单位&nbsp;:&nbsp;m/s2 | 测量重力大小 |
| SENSOR_TYPE_GYROSCOPE | 陀螺仪传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,设备的旋转角速度,单位&nbsp;:&nbsp;rad/s | 测量旋转的角速度 |
| SENSOR_TYPE_GYROSCOPE_UNCALIBRATED | 未校准陀螺仪传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,设备的未校准旋转角速度,单位&nbsp;:&nbsp;rad/s | 测量旋转的角速度及偏差估值 |
| SENSOR_TYPE_SIGNIFICANT_MOTION | 大幅度动作传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,设备是否存在大幅度运动;如果取值为1则代表存在大幅度运动,取值为0则代表没有大幅度运动 | 用于检测设备是否存在大幅度运动 |
| SENSOR_TYPE_PEDOMETER_DETECTION | 计步器检测传感器 | 检测用户的计步动作;如果取值为1则代表用户产生了计步行走的动作;取值为0则代表用户没有发生运动 | 用于检测用户是否有计步的动作 |
| SENSOR_TYPE_PEDOMETER | 计步器传感器 | 统计用户的行走步数 | 用于提供用户行走的步数数据 |
| SENSOR_TYPE_AMBIENT_TEMPERATURE | 环境温度传感器 | 测量环境温度,单位&nbsp;:&nbsp;摄氏度&nbsp;(°C) | 测量环境温度 |
| SENSOR_TYPE_MAGNETIC_FIELD | 磁场传感器 | 测量三个物理轴向(x、y、z)上,环境地磁场,单位&nbsp;:&nbsp;μT | 创建指南针 |
| SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | 未校准磁场传感器 | 测量三个物理轴向(x、y、z)上,未校准环境地磁场,单位&nbsp;:&nbsp;μT | 测量地磁偏差估值 |
| SENSOR_TYPE_HUMIDITY | 湿度传感器 | 测量环境的相对湿度,以百分比&nbsp;(%)&nbsp;表示 | 监测露点、绝对湿度和相对湿度 |
| SENSOR_TYPE_BAROMETER | 气压计传感器 | 测量环境气压,单位&nbsp;:&nbsp;hPa&nbsp;&nbsp;mbar | 测量环境气压 |
| SENSOR_TYPE_ORIENTATION | 方向传感器 | 测量设备围绕所有三个物理轴(x、y、z)旋转的角度值,单位:rad | 用于提供屏幕旋转的3个角度值 |
| SENSOR_TYPE_ROTATION_VECTOR | 旋转矢量传感器 | 测量设备旋转矢量,复合传感器:由加速度传感器、磁场传感器、陀螺仪传感器合成 | 检测设备相对于东北天坐标系的方向 |
| SENSOR_TYPE_PROXIMITY | 接近光传感器 | 测量可见物体相对于设备显示屏的接近或远离状态 | 通话中设备相对人的位置 |
| SENSOR_TYPE_AMBIENT_LIGHT | 环境光传感器 | 测量设备周围光线强度,单位:lux | 自动调节屏幕亮度,检测屏幕上方是否有遮挡 |
| SENSOR_TYPE_HEART_RATE | 心率传感器 | 测量用户的心率数值 | 用于提供用户的心率健康数据 |
| SENSOR_TYPE_WEAR_DETECTION | 佩戴检测传感器 | 检测用户是否佩戴 | 用于检测用户是否佩戴智能穿戴 |
| SENSOR_TYPE_HALL | 霍尔传感器 | 测量设备周围是否存在磁力吸引 | 设备的皮套模式 |
| 传感器类型 | 描述 | 说明 | 主要用途 |
| --------------------------------------- | --------- | ---------------------------------------- | -------------------- |
| SENSOR_TYPE_ACCELEROMETER | 加速度传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,施加在设备上的加速度(包括重力加速度),单位&nbsp;:&nbsp;m/s2 | 检测运动状态 |
| SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED | 未校准加速度传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,施加在设备上的未校准的加速度(包括重力加速度),单位&nbsp;:&nbsp;m/s2 | 检测加速度偏差估值 |
| SENSOR_TYPE_LINEAR_ACCELERATION | 线性加速度传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,施加在设备上的线性加速度(不包括重力加速度),单位&nbsp;:&nbsp;m/s2 | 检测每个单轴方向上的线性加速度 |
| SENSOR_TYPE_GRAVITY | 重力传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,施加在设备上的重力加速度,单位&nbsp;:&nbsp;m/s2 | 测量重力大小 |
| SENSOR_TYPE_GYROSCOPE | 陀螺仪传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,设备的旋转角速度,单位&nbsp;:&nbsp;rad/s | 测量旋转的角速度 |
| SENSOR_TYPE_GYROSCOPE_UNCALIBRATED | 未校准陀螺仪传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,设备的未校准旋转角速度,单位&nbsp;:&nbsp;rad/s | 测量旋转的角速度及偏差估值 |
| SENSOR_TYPE_SIGNIFICANT_MOTION | 大幅度动作传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,设备是否存在大幅度运动;如果取值为1则代表存在大幅度运动,取值为0则代表没有大幅度运动 | 用于检测设备是否存在大幅度运动 |
| SENSOR_TYPE_PEDOMETER_DETECTION | 计步器检测传感器 | 检测用户的计步动作;如果取值为1则代表用户产生了计步行走的动作;取值为0则代表用户没有发生运动 | 用于检测用户是否有计步的动作 |
| SENSOR_TYPE_PEDOMETER | 计步器传感器 | 统计用户的行走步数 | 用于提供用户行走的步数数据 |
| SENSOR_TYPE_AMBIENT_TEMPERATURE | 环境温度传感器 | 测量环境温度,单位&nbsp;:&nbsp;摄氏度&nbsp;(°C) | 测量环境温度 |
| SENSOR_TYPE_MAGNETIC_FIELD | 磁场传感器 | 测量三个物理轴向(x、y、z)上,环境地磁场,单位&nbsp;:&nbsp;μT | 创建指南针 |
| SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | 未校准磁场传感器 | 测量三个物理轴向(x、y、z)上,未校准环境地磁场,单位&nbsp;:&nbsp;μT | 测量地磁偏差估值 |
| SENSOR_TYPE_HUMIDITY | 湿度传感器 | 测量环境的相对湿度,以百分比&nbsp;(%)&nbsp;表示 | 监测露点、绝对湿度和相对湿度 |
| SENSOR_TYPE_BAROMETER | 气压计传感器 | 测量环境气压,单位&nbsp;:&nbsp;hPa&nbsp;&nbsp;mbar | 测量环境气压 |
| SENSOR_TYPE_ORIENTATION | 方向传感器 | 测量设备围绕所有三个物理轴(x、y、z)旋转的角度值,单位:rad | 用于提供屏幕旋转的3个角度值 |
| SENSOR_TYPE_ROTATION_VECTOR | 旋转矢量传感器 | 测量设备旋转矢量,复合传感器:由加速度传感器、磁场传感器、陀螺仪传感器合成 | 检测设备相对于东北天坐标系的方向 |
| SENSOR_TYPE_PROXIMITY | 接近光传感器 | 测量可见物体相对于设备显示屏的接近或远离状态 | 通话中设备相对人的位置 |
| SENSOR_TYPE_AMBIENT_LIGHT | 环境光传感器 | 测量设备周围光线强度,单位:lux | 自动调节屏幕亮度,检测屏幕上方是否有遮挡 |
| SENSOR_TYPE_HEART_RATE | 心率传感器 | 测量用户的心率数值 | 用于提供用户的心率健康数据 |
| SENSOR_TYPE_WEAR_DETECTION | 佩戴检测传感器 | 检测用户是否佩戴 | 用于检测用户是否佩戴智能穿戴 |
| SENSOR_TYPE_HALL | 霍尔传感器 | 测量设备周围是否存在磁力吸引 | 设备的皮套模式 |
## 运作机制
......@@ -54,12 +54,12 @@ OpenHarmony传感器包含如下四个模块:Sensor API、Sensor Framework、S
表7 传感器数据权限
| 传感器 | 权限名 | 敏感级别 | 权限描述 |
| ------------------------- | -------------------------------- | ------------ | ----------------------- |
| 加速度传感器,加速度未校准传感器,线性加速度传感器 | ohos.permission.ACCELEROMETER | system_grant | 允许订阅Motion组对应的加速度传感器的数据 |
| 陀螺仪传感器,陀螺仪未校准传感器 | ohos.permission.GYROSCOPE | system_grant | 允许订阅Motion组对应的陀螺仪传感器的数据 |
| 计步器 | ohos.permission.ACTIVITY_MOTION | user_grant | 允许订阅运动状态 |
| 心率计 | ohos.permission.READ_HEALTH_DATA | user_grant | 允许读取健康数据 |
| 传感器 | 权限名 | 敏感级别 | 权限描述 |
| ------------------------- | -------------------------------- | ------------ | ----------------------- |
| 加速度传感器,加速度未校准传感器,线性加速度传感器 | ohos.permission.ACCELEROMETER | system_grant | 允许订阅Motion组对应的加速度传感器的数据 |
| 陀螺仪传感器,陀螺仪未校准传感器 | ohos.permission.GYROSCOPE | system_grant | 允许订阅Motion组对应的陀螺仪传感器的数据 |
| 计步器 | ohos.permission.ACTIVITY_MOTION | user_grant | 允许订阅运动状态 |
| 心率计 | ohos.permission.READ_HEALTH_DATA | user_grant | 允许读取健康数据 |
......
......@@ -22,15 +22,15 @@ requestSuspendDelay(reason: string, callback: Callback&lt;void&gt;): DelaySuspen
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| reason | string | 是 | 延迟挂起申请的原因。 |
| callback | Callback&lt;void&gt; | 是 | 延迟即将超时的回调函数,一般在超时前6秒通过此回调通知应用。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------ |
| reason | string | 是 | 延迟挂起申请的原因。 |
| callback | Callback&lt;void&gt; | 是 | 延迟即将超时的回调函数,一般在超时前6秒通过此回调通知应用。 |
**返回值**
| 类型 | 说明 |
| -------- | -------- |
| [DelaySuspendInfo](#delaysuspendinfo) | 返回延迟挂起信息。 |
| 类型 | 说明 |
| ------------------------------------- | --------- |
| [DelaySuspendInfo](#delaysuspendinfo) | 返回延迟挂起信息。 |
**示例**
```js
......@@ -50,10 +50,10 @@ getRemainingDelayTime(requestId: number, callback: AsyncCallback&lt;number&gt;):
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| requestId | number | 是 | 延迟挂起的请求ID。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 指定的callback回调方法。用于返回应用程序进入挂起状态之前的剩余时间,以毫秒为单位。 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | --------------------------- | ---- | ---------------------------------------- |
| requestId | number | 是 | 延迟挂起的请求ID。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 指定的callback回调方法。用于返回应用程序进入挂起状态之前的剩余时间,以毫秒为单位。 |
**示例**
......@@ -78,14 +78,14 @@ getRemainingDelayTime(requestId: number): Promise&lt;number&gt;
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| requestId | number | 是 | 延迟挂起的请求ID。 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ---------- |
| requestId | number | 是 | 延迟挂起的请求ID。 |
**返回值**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;number&gt; | 指定的Promise回调方法。返回应用程序进入挂起状态之前的剩余时间,以毫秒为单位。 |
| 类型 | 说明 |
| --------------------- | ---------------------------------------- |
| Promise&lt;number&gt; | 指定的Promise回调方法。返回应用程序进入挂起状态之前的剩余时间,以毫秒为单位。 |
**示例**
```js
......@@ -107,9 +107,9 @@ cancelSuspendDelay(requestId: number): void
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| requestId | number | 是 | 延迟挂起的请求ID。 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ---------- |
| requestId | number | 是 | 延迟挂起的请求ID。 |
**示例**
```js
......@@ -128,12 +128,12 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。|
| wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动长时任务的结果。 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ---------------------------------- | ---- | ------------------------ |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 |
| wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动长时任务的结果。 |
**示例**
```js
......@@ -180,16 +180,16 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 |
| wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ---------------------------------- | ---- | ----------------------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 |
| wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 |
**返回值**
| 类型 | 说明 |
| -------------- | ------------------------- |
| Promise\<void> | 使用Promise形式返回结果。 |
| 类型 | 说明 |
| -------------- | ---------------- |
| Promise\<void> | 使用Promise形式返回结果。 |
**示例**
```js
......@@ -229,10 +229,10 @@ stopBackgroundRunning(context: Context, callback: AsyncCallback&lt;void&gt;): vo
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动长时任务的结果。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | ---------------------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动长时任务的结果。 |
**示例**
```js
......@@ -260,14 +260,14 @@ stopBackgroundRunning(context: Context): Promise&lt;void&gt;
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ----------------------------- | ---- | --------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
**返回值**
| 类型 | 说明 |
| -------------- | ------------------------- |
| Promise\<void> | 使用Promise形式返回结果。 |
| 类型 | 说明 |
| -------------- | ---------------- |
| Promise\<void> | 使用Promise形式返回结果。 |
**示例**
```js
......@@ -288,24 +288,24 @@ backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then(()
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| requestId | number | 是 | 延迟挂起的请求ID。 |
| actualDelayTime | number | 是 | 应用的实际挂起延迟时间,以毫秒为单位。<br/>一般情况下默认值为180000,低电量(依据系统低电量广播)时默认值为60000。 |
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | ------ | ---- | ---------------------------------------- |
| requestId | number | 是 | 延迟挂起的请求ID。 |
| actualDelayTime | number | 是 | 应用的实际挂起延迟时间,以毫秒为单位。<br/>一般情况下默认值为180000,低电量(依据系统低电量广播)时默认值为60000。 |
## BackgroundMode<sup>8+</sup>
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
| 参数名 | 参数值 | 描述 |
| ----------------------- | -------- | -------- |
| DATA_TRANSFER | 1 | 数据传输 |
| AUDIO_PLAYBACK | 2 | 音频播放 |
| AUDIO_RECORDING | 3 | 录音 |
| LOCATION | 4 | 定位导航 |
| BLUETOOTH_INTERACTION | 5 | 蓝牙相关 |
| MULTI_DEVICE_CONNECTION | 6 | 多设备互联 |
| WIFI_INTERACTION | 7 | WLAN相关(系统保留) |
| VOIP | 8 | 音视频通话(系统保留) |
| TASK_KEEPING | 9 | 计算任务(仅供PC使用) |
\ No newline at end of file
| 参数名 | 参数值 | 描述 |
| ----------------------- | ---- | ------------ |
| DATA_TRANSFER | 1 | 数据传输 |
| AUDIO_PLAYBACK | 2 | 音频播放 |
| AUDIO_RECORDING | 3 | 录音 |
| LOCATION | 4 | 定位导航 |
| BLUETOOTH_INTERACTION | 5 | 蓝牙相关 |
| MULTI_DEVICE_CONNECTION | 6 | 多设备互联 |
| WIFI_INTERACTION | 7 | WLAN相关(系统保留) |
| VOIP | 8 | 音视频通话(系统保留) |
| TASK_KEEPING | 9 | 计算任务 |
\ No newline at end of file
......@@ -21,9 +21,9 @@ showToast(options: ShowToastOptions): void
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [ShowToastOptions](#showtoastoptions) | 是 | 文本弹窗选项。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------------------------- | ---- | ------- |
| options | [ShowToastOptions](#showtoastoptions) | 是 | 文本弹窗选项。 |
**示例:**
```
......@@ -42,11 +42,11 @@ showToast(options: ShowToastOptions): void
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| message | string | 是 | 显示的文本信息。 |
| duration | number | 否 | 默认值1500ms,建议区间:1500ms-10000ms,若小于1500ms则取默认值。 |
| bottom | &lt;length&gt; | 否 | 设置弹窗边框距离屏幕底部的位置,仅手机和平板设备支持。 |
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------------- | ---- | ---------------------------------------- |
| message | string | 是 | 显示的文本信息。 |
| duration | number | 否 | 默认值1500ms,建议区间:1500ms-10000ms,若小于1500ms则取默认值。 |
| bottom | &lt;length&gt; | 否 | 设置弹窗边框距离屏幕底部的位置。 |
## prompt.showDialog
......@@ -57,15 +57,15 @@ showDialog(options: ShowDialogOptions): Promise&lt;ShowDialogSuccessResponse&gt;
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [ShowDialogOptions](#showdialogoptions) | 是 | 对话框选项。|
| 参数名 | 类型 | 必填 | 说明 |
| ------- | --------------------------------------- | ---- | ------ |
| options | [ShowDialogOptions](#showdialogoptions) | 是 | 对话框选项。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;[ShowDialogSuccessResponse](#showdialogsuccessresponse)&gt; | 对话框响应结果。|
| 类型 | 说明 |
| ---------------------------------------- | -------- |
| Promise&lt;[ShowDialogSuccessResponse](#showdialogsuccessresponse)&gt; | 对话框响应结果。 |
**示例:**
......@@ -106,10 +106,10 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback&lt;ShowDialogSucc
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [ShowDialogOptions](#showdialogoptions) | 是 | 页面显示对话框信息描述。|
| callback | AsyncCallback&lt;[ShowDialogSuccessResponse](#showdialogsuccessresponse)&gt; | 是 | 对话框响应结果回调。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------ |
| options | [ShowDialogOptions](#showdialogoptions) | 是 | 页面显示对话框信息描述。 |
| callback | AsyncCallback&lt;[ShowDialogSuccessResponse](#showdialogsuccessresponse)&gt; | 是 | 对话框响应结果回调。 |
**示例:**
```
......@@ -146,11 +146,11 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback&lt;ShowDialogSucc
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| title | string | 否 | 标题文本。 |
| message | string | 否 | 内容文本。 |
| buttons | Array | 否 | 对话框中按钮的数组,结构为:{text:'button',&nbsp;color:&nbsp;'\#666666'},支持1-3个按钮。其中第一个为positiveButton;第二个为negativeButton;第三个为neutralButton。 |
| 名称 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ---------------------------------------- |
| title | string | 否 | 标题文本。 |
| message | string | 否 | 内容文本。 |
| buttons | Array | 否 | 对话框中按钮的数组,结构为:{text:'button',&nbsp;color:&nbsp;'\#666666'},支持1-3个按钮。其中第一个为positiveButton;第二个为negativeButton;第三个为neutralButton。 |
## ShowDialogSuccessResponse
......@@ -158,8 +158,8 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback&lt;ShowDialogSucc
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 说明 |
| -------- | -------- | -------- |
| 名称 | 类型 | 说明 |
| ----- | ------ | ------------------- |
| index | number | 选中按钮在buttons数组中的索引。 |
......@@ -172,10 +172,10 @@ showActionMenu(options: ActionMenuOptions, callback: AsyncCallback&lt;ActionMenu
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [ActionMenuOptions](#actionmenuoptions) | 是 | 操作菜单选项。 |
| callback | AsyncCallback&lt;[ActionMenuSuccessResponse](#actionmenusuccessresponse)> | 是 | 菜单响应结果回调。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| options | [ActionMenuOptions](#actionmenuoptions) | 是 | 操作菜单选项。 |
| callback | AsyncCallback&lt;[ActionMenuSuccessResponse](#actionmenusuccessresponse)> | 是 | 菜单响应结果回调。 |
**示例:**
......@@ -215,14 +215,14 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>
**系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options | [ActionMenuOptions](#actionmenuoptions) | 是 | 操作菜单选项。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | --------------------------------------- | ---- | ------- |
| options | [ActionMenuOptions](#actionmenuoptions) | 是 | 操作菜单选项。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;[ActionMenuSuccessResponse](#actionmenusuccessresponse)&gt; | 菜单响应结果。|
| 类型 | 说明 |
| ---------------------------------------- | ------- |
| Promise&lt;[ActionMenuSuccessResponse](#actionmenusuccessresponse)&gt; | 菜单响应结果。 |
**示例:**
```
......@@ -256,10 +256,10 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| title | string | 否 | 标题文本。 |
| buttons | Array | 是 | 菜单中菜单项按钮的数组,结构为:{text:'button',&nbsp;color:&nbsp;'\#666666'},支持1-6个按钮。大于6个按钮时弹窗不显示。 |
| 名称 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ---------------------------------------- |
| title | string | 否 | 标题文本。 |
| buttons | Array | 是 | 菜单中菜单项按钮的数组,结构为:{text:'button',&nbsp;color:&nbsp;'\#666666'},支持1-6个按钮。大于6个按钮时弹窗不显示。 |
## ActionMenuSuccessResponse
......@@ -267,7 +267,7 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| index | number | 否 | 选中按钮在buttons数组中的索引,从0开始。 |
| 名称 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ------------------------ |
| index | number | 否 | 选中按钮在buttons数组中的索引,从0开始。 |
......@@ -135,7 +135,7 @@ export default {
| ------------------- | -------------- | ---- | ---------------------------------------- |
| message | string | 是 | 显示的文本信息。 |
| duration | number | 否 | 默认值1500ms,建议区间:1500ms-10000ms。若小于1500ms则取默认值,最大取值为10000ms。 |
| bottom<sup>5+</sup> | string\|number | 否 | 设置弹窗边框距离屏幕底部的位置,仅手机和平板设备支持。 |
| bottom<sup>5+</sup> | string\|number | 否 | 设置弹窗边框距离屏幕底部的位置 |
## Button
......
......@@ -18,9 +18,9 @@ import sensor from '@system.sensor';
## 传感器错误码列表
| 错误码 | 说明 |
| -------- | -------- |
| 900 | 当前设备不支持相应的传感器。 |
| 错误码 | 说明 |
| ---- | -------------- |
| 900 | 当前设备不支持相应的传感器。 |
## sensor.subscribeAccelerometer
......@@ -34,19 +34,19 @@ subscribeAccelerometer(Object): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| interval | string | 是 | 频率参数,加速度的回调函数执行频率。<br/>默认为normal,可选值有:<br/>-&nbsp;game:极高的回调频率,20ms/次,适用于游戏。<br/>-&nbsp;ui:较高的回调频率,60ms/次,适用于UI更新。<br/>-&nbsp;normal:普通的回调频率,200ms/次,低功耗。 |
| success | Function | 是 | 感应到加速度数据变化后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ---------------------------------------- |
| interval | string | 是 | 频率参数,加速度的回调函数执行频率。<br/>默认为normal,可选值有:<br/>-&nbsp;game:极高的回调频率,20ms/次,适用于游戏。<br/>-&nbsp;ui:较高的回调频率,60ms/次,适用于UI更新。<br/>-&nbsp;normal:普通的回调频率,200ms/次,低功耗。 |
| success | Function | 是 | 感应到加速度数据变化后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| x | number | x轴的加速度。 |
| y | number | y轴的加速度。 |
| z | number | z轴的加速度。 |
| 参数名 | 类型 | 说明 |
| ---- | ------ | ------- |
| x | number | x轴的加速度。 |
| y | number | y轴的加速度。 |
| z | number | z轴的加速度。 |
**示例:**
......@@ -93,16 +93,16 @@ subscribeCompass(Object): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | Function | 是 | 罗盘数据改变后触发的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------- | ---- | --------------- |
| success | Function | 是 | 罗盘数据改变后触发的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| direction | number | 设备面对的方向度数。 |
| 参数名 | 类型 | 说明 |
| --------- | ------ | ---------- |
| direction | number | 设备面对的方向度数。 |
**示例:**
......@@ -144,16 +144,16 @@ subscribeProximity(Object): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | Function | 是 | 距离感应数据改变后调用的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------- | ---- | ----------------- |
| success | Function | 是 | 距离感应数据改变后调用的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| distance | number | 可见物体相对于设备显示屏的接近或远离状态。 |
| 参数名 | 类型 | 说明 |
| -------- | ------ | --------------------- |
| distance | number | 可见物体相对于设备显示屏的接近或远离状态。 |
**示例:**
......@@ -195,16 +195,16 @@ sensor.subscribeLight(Object): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | Function | 是 | 光线感应数据改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------- | ---- | --------------- |
| success | Function | 是 | 光线感应数据改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| intensity | number | 光线强度,单位为lux。 |
| 参数名 | 类型 | 说明 |
| --------- | ------ | ------------ |
| intensity | number | 光线强度,单位为lux。 |
**示例:**
......@@ -248,16 +248,16 @@ subscribeStepCounter(Object): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | Function | 是 | 计步传感器数据改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------- | ---- | ---------------- |
| success | Function | 是 | 计步传感器数据改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| steps | number | 计步传感器重启后累计记录的步数。<br/> |
| 参数名 | 类型 | 说明 |
| ----- | ------ | --------------------- |
| steps | number | 计步传感器重启后累计记录的步数。<br/> |
**示例:**
......@@ -302,16 +302,16 @@ subcribeBarometer(Object): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | Function | 是 | 气压传感器数据改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------- | ---- | ---------------- |
| success | Function | 是 | 气压传感器数据改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| pressure | number | 气压值,单位:帕斯卡。 |
| 参数名 | 类型 | 说明 |
| -------- | ------ | ----------- |
| pressure | number | 气压值,单位:帕斯卡。 |
**示例:**
......@@ -357,16 +357,16 @@ subscribeHeartRate(Object): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | Function | 是 | 心率传感器数据改变后的回调函数,默认频率5s/次。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------- | ---- | ------------------------- |
| success | Function | 是 | 心率传感器数据改变后的回调函数,默认频率5s/次。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| heartRate | number | 心率值。 |
| 参数名 | 类型 | 说明 |
| --------- | ------ | ---- |
| heartRate | number | 心率值。 |
**示例:**
......@@ -411,16 +411,16 @@ subscribeOnBodyState(Object): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | Function | 是 | 穿戴状态改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------- | ---- | ------------- |
| success | Function | 是 | 穿戴状态改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| value | boolean | 是否已佩戴。 |
| 参数名 | 类型 | 说明 |
| ----- | ------- | ------ |
| value | boolean | 是否已佩戴。 |
**示例:**
......@@ -462,17 +462,17 @@ getOnBodyState(Object): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ------------ |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| value | boolean | 是否已佩戴。 |
| 参数名 | 类型 | 说明 |
| ----- | ------- | ------ |
| value | boolean | 是否已佩戴。 |
**示例:**
......@@ -499,18 +499,18 @@ subscribeDeviceOrientation(interval: string, success: (data: DeviceOrientationRe
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| interval | string | 是 | 频率参数,设备方向传感器的回调函数执行频率。<br/>默认为normal,可选值有:<br/>-&nbsp;game:极高的回调频率,20ms/次,适用于游戏。<br/>-&nbsp;ui:较高的回调频率,60ms/次,适用于UI更新。<br/>-&nbsp;normal:普通的回调频率,200ms/次,低功耗。 |
| success | Function | 是 | 感应到设备方向传感器数据变化后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ---------------------------------------- |
| interval | string | 是 | 频率参数,设备方向传感器的回调函数执行频率。<br/>默认为normal,可选值有:<br/>-&nbsp;game:极高的回调频率,20ms/次,适用于游戏。<br/>-&nbsp;ui:较高的回调频率,60ms/次,适用于UI更新。<br/>-&nbsp;normal:普通的回调频率,200ms/次,低功耗。 |
| success | Function | 是 | 感应到设备方向传感器数据变化后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| alpha | number | 当手机坐标&nbsp;X/Y&nbsp;和地球&nbsp;X/Y&nbsp;重合时,绕着&nbsp;Z&nbsp;轴转动的夹角为&nbsp;alpha。 |
| beta | number | 当手机坐标&nbsp;Y/Z&nbsp;和地球&nbsp;Y/Z&nbsp;重合时,绕着&nbsp;X&nbsp;轴转动的夹角为&nbsp;beta。 |
| gamma | number | 当手机&nbsp;X/Z&nbsp;和地球&nbsp;X/Z&nbsp;重合时,绕着&nbsp;Y&nbsp;轴转动的夹角为&nbsp;gamma。 |
| 参数名 | 类型 | 说明 |
| ----- | ------ | ---------------------------------------- |
| alpha | number | 当设备坐标&nbsp;X/Y&nbsp;和地球&nbsp;X/Y&nbsp;重合时,绕着&nbsp;Z&nbsp;轴转动的夹角为&nbsp;alpha。 |
| beta | number | 当设备坐标&nbsp;Y/Z&nbsp;和地球&nbsp;Y/Z&nbsp;重合时,绕着&nbsp;X&nbsp;轴转动的夹角为&nbsp;beta。 |
| gamma | number | 当设备&nbsp;X/Z&nbsp;和地球&nbsp;X/Z&nbsp;重合时,绕着&nbsp;Y&nbsp;轴转动的夹角为&nbsp;gamma。 |
**示例:**
......@@ -559,19 +559,19 @@ subscribeGyroscope(interval: string, success: (data: GyroscopeResponse), fail?:
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| interval | string | 是 | 频率参数,陀螺仪的回调函数执行频率。<br/>默认为normal,可选值有:<br/>-&nbsp;game:极高的回调频率,20ms/次,适用于游戏。<br/>-&nbsp;ui:较高的回调频率,60ms/次,适用于UI更新。<br/>-&nbsp;normal:普通的回调频率,200ms/次,低功耗。 |
| success | Function | 是 | 感应到陀螺仪数据变化后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ---------------------------------------- |
| interval | string | 是 | 频率参数,陀螺仪的回调函数执行频率。<br/>默认为normal,可选值有:<br/>-&nbsp;game:极高的回调频率,20ms/次,适用于游戏。<br/>-&nbsp;ui:较高的回调频率,60ms/次,适用于UI更新。<br/>-&nbsp;normal:普通的回调频率,200ms/次,低功耗。 |
| success | Function | 是 | 感应到陀螺仪数据变化后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| x | number | x轴的旋转角速度。 |
| y | number | y轴的旋转角速度。 |
| z | number | z轴的旋转角速度。 |
| 参数名 | 类型 | 说明 |
| ---- | ------ | --------- |
| x | number | x轴的旋转角速度。 |
| y | number | y轴的旋转角速度。 |
| z | number | z轴的旋转角速度。 |
**示例:**
......
# 升级
升级
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......@@ -8,7 +8,7 @@
升级依赖:升级分为SD卡升级和在线升级两种。
- SD卡升级依赖升级包和SD卡安装。
- 在线升级依赖手机厂商部署的用于管理升级包的服务器。服务器由手机厂商部署,IP由调用者传入,请求的request接口是固定的,由手机厂商开发。
- 在线升级依赖设备厂商部署的用于管理升级包的服务器。服务器由设备厂商部署,IP由调用者传入,请求的request接口是固定的,由设备厂商开发。
## 导入模块
......
......@@ -15,68 +15,68 @@
除支持[通用属性](../arkui-js/js-components-common-attributes.md)外,还支持如下属性:
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- |
| type | string | text | 否 | 设置滑动选择器的类型,该属性不支持动态修改,可选项有:<br/>-&nbsp;text:文本选择器。<br/>-&nbsp;time:时间选择器。<br/>-&nbsp;date:日期选择器。<br/>-&nbsp;datetime:日期时间选择器。<br/>-&nbsp;multi-text:多列文本选择器。 |
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| ---- | ------ | ---- | ---- | ---------------------------------------- |
| type | string | text | 否 | 设置滑动选择器的类型,该属性不支持动态修改,可选项有:<br/>-&nbsp;text:文本选择器。<br/>-&nbsp;time:时间选择器。<br/>-&nbsp;date:日期选择器。<br/>-&nbsp;datetime:日期时间选择器。<br/>-&nbsp;multi-text:多列文本选择器。 |
文本选择器:type=text
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- |
| range | Array | - | 否 | 设置文本选择器的取值范围。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;使用时需要使用数据绑定的方式,如range&nbsp;=&nbsp;{{data}},js中声明相应变量:data:["15",&nbsp;"20",&nbsp;"25"]。 |
| selected | string | 0 | 否 | 设置文本选择器的默认选择值,该值需要为range的索引。 |
| indicatorprefix | string | - | 否 | 文本选择器选定值增加的前缀字段。 |
| indicatorsuffix | string | - | 否 | 文本选择器选定值增加的后缀字段。 |
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| --------------- | ------ | ---- | ---- | ---------------------------------------- |
| range | Array | - | 否 | 设置文本选择器的取值范围。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;使用时需要使用数据绑定的方式,如range&nbsp;=&nbsp;{{data}},js中声明相应变量:data:["15",&nbsp;"20",&nbsp;"25"]。 |
| selected | string | 0 | 否 | 设置文本选择器的默认选择值,该值需要为range的索引。 |
| indicatorprefix | string | - | 否 | 文本选择器选定值增加的前缀字段。 |
| indicatorsuffix | string | - | 否 | 文本选择器选定值增加的后缀字段。 |
时间选择器:type=time
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- |
| containsecond | boolean | false | 否 | 时间选择器是否包含秒。 |
| selected | string | 当前时间 | 否 | 设置时间选择器的默认取值,格式为&nbsp;HH:mm;<br/>当包含秒时,格式为HH:mm:ss。 |
| hours | number | 24<sup>1-4</sup><br/>-<sup>5+</sup> | 否 | 设置时间选择器采用的时间格式,可选值:<br/>-&nbsp;12:按照12小时制显示,用上午和下午进行区分;<br/>-&nbsp;24:按照24小时制显示。<br/>&nbsp;&nbsp;>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>&nbsp;&nbsp;>&nbsp;默认值会依据系统当前所选地区和语言选择当地习惯的小时制(12小时制或24小时制)。<sup>5+</sup> |
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| ------------- | ------- | ----------------------------------- | ---- | ---------------------------------------- |
| containsecond | boolean | false | 否 | 时间选择器是否包含秒。 |
| selected | string | 当前时间 | 否 | 设置时间选择器的默认取值,格式为&nbsp;HH:mm;<br/>当包含秒时,格式为HH:mm:ss。 |
| hours | number | 24<sup>1-4</sup><br/>-<sup>5+</sup> | 否 | 设置时间选择器采用的时间格式,可选值:<br/>-&nbsp;12:按照12小时制显示,用上午和下午进行区分;<br/>-&nbsp;24:按照24小时制显示。<br/>&nbsp;&nbsp;>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>&nbsp;&nbsp;>&nbsp;默认值会依据系统当前所选地区和语言选择当地习惯的小时制(12小时制或24小时制)。<sup>5+</sup> |
日期选择器:type=date
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- |
| start | &lt;time&gt; | 1970-1-1 | 否 | 设置日期选择器的起始时间,格式为&nbsp;YYYY-MM-DD。 |
| end | &lt;time&gt; | 2100-12-31 | 否 | 设置日期选择器的结束时间,格式为&nbsp;YYYY-MM-DD。 |
| selected | string | 当前日期 | 否 | 设置日期选择器的默认选择值,格式为&nbsp;YYYY-MM-DD。 |
| lunar<sup>5+</sup> | boolean | false | 否 | 设置日期选择器弹窗界面是否为农历展示。 |
| lunarswitch | boolean | false | 否 | 设置日期选择器是否显示农历开关,显示农历开关时,可以在弹窗界面展现农历的开关由于公历和农历切换。在设置显示农历时,开关状态为开,当设置不显示农历时,开关状态为关。手机生效。 |
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| ------------------ | ------------ | ---------- | ---- | ---------------------------------------- |
| start | &lt;time&gt; | 1970-1-1 | 否 | 设置日期选择器的起始时间,格式为&nbsp;YYYY-MM-DD。 |
| end | &lt;time&gt; | 2100-12-31 | 否 | 设置日期选择器的结束时间,格式为&nbsp;YYYY-MM-DD。 |
| selected | string | 当前日期 | 否 | 设置日期选择器的默认选择值,格式为&nbsp;YYYY-MM-DD。 |
| lunar<sup>5+</sup> | boolean | false | 否 | 设置日期选择器弹窗界面是否为农历展示。 |
| lunarswitch | boolean | false | 否 | 设置日期选择器是否显示农历开关,显示农历开关时,可以在弹窗界面展现农历的开关由于公历和农历切换。在设置显示农历时,开关状态为开,当设置不显示农历时,开关状态为关。 |
日期时间选择器:type=datetime,日期的选择范围为本年的日月。
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- |
| selected | string | 当前日期时间 | 否 | 设置日期时间选择器的默认取值,格式有两种,为月日时分MM-DD-HH-mm或者年月日时分YYYY-MM-DD-HH-mm,不设置年时,默认使用当前年,该取值表示选择器弹窗时弹窗界面的默认选择值。 |
| hours | number | 24<sup>1-4</sup><br/>-<sup>5+</sup> | 否 | 设置日期时间选择器采用的时间格式,可选值:<br/>-&nbsp;12:按照12小时制显示,用上午和下午进行区分;<br/>-&nbsp;24:按照24小时制显示。<br/>&nbsp;&nbsp;>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>&nbsp;&nbsp;>&nbsp;默认值会依据系统当前所选地区和语言选择当地习惯的小时制(12小时制或24小时制)。<sup>5+</sup> |
| lunar<sup>5+</sup> | boolean | false | 否 | 设置日期时间选择器弹窗界面是否为农历展示。 |
| lunarswitch | boolean | false | 否 | 设置日期时间选择器是否显示农历开关,显示农历开关时,可以在弹窗界面展现农历的开关由于公历和农历切换。在设置显示农历时,开关状态为开,当设置不显示农历时,开关状态为关。手机生效。 |
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| ------------------ | ------- | ----------------------------------- | ---- | ---------------------------------------- |
| selected | string | 当前日期时间 | 否 | 设置日期时间选择器的默认取值,格式有两种,为月日时分MM-DD-HH-mm或者年月日时分YYYY-MM-DD-HH-mm,不设置年时,默认使用当前年,该取值表示选择器弹窗时弹窗界面的默认选择值。 |
| hours | number | 24<sup>1-4</sup><br/>-<sup>5+</sup> | 否 | 设置日期时间选择器采用的时间格式,可选值:<br/>-&nbsp;12:按照12小时制显示,用上午和下午进行区分;<br/>-&nbsp;24:按照24小时制显示。<br/>&nbsp;&nbsp;>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>&nbsp;&nbsp;>&nbsp;默认值会依据系统当前所选地区和语言选择当地习惯的小时制(12小时制或24小时制)。<sup>5+</sup> |
| lunar<sup>5+</sup> | boolean | false | 否 | 设置日期时间选择器弹窗界面是否为农历展示。 |
| lunarswitch | boolean | false | 否 | 设置日期时间选择器是否显示农历开关,显示农历开关时,可以在弹窗界面展现农历的开关由于公历和农历切换。在设置显示农历时,开关状态为开,当设置不显示农历时,开关状态为关。 |
多列文本选择器:type=multi-text
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- |
| columns | number | - | 是 | 设置多列文本选择器的列数。 |
| range | 二维Array | - | 否 | 设置多列文本选择器的选择值,该值为二维数组。长度表示多少列,数组的每项表示每列的数据,如&nbsp;&nbsp;[["a","b"],&nbsp;["c","d"]]。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;使用时需要使用数据绑定的方式,如range&nbsp;=&nbsp;{{data}},js中声明相应变量:data:[["a","b"],&nbsp;["c","d"]]。 |
| selected | Array | [0,0,0,…] | 否 | 设置多列文本选择器的默认值,每一列被选中项对应的索引构成的数组,该取值表示选择器弹窗时弹窗界面的默认选择值。 |
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | ------- | --------- | ---- | ---------------------------------------- |
| columns | number | - | 是 | 设置多列文本选择器的列数。 |
| range | 二维Array | - | 否 | 设置多列文本选择器的选择值,该值为二维数组。长度表示多少列,数组的每项表示每列的数据,如&nbsp;&nbsp;[["a","b"],&nbsp;["c","d"]]。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;使用时需要使用数据绑定的方式,如range&nbsp;=&nbsp;{{data}},js中声明相应变量:data:[["a","b"],&nbsp;["c","d"]]。 |
| selected | Array | [0,0,0,…] | 否 | 设置多列文本选择器的默认值,每一列被选中项对应的索引构成的数组,该取值表示选择器弹窗时弹窗界面的默认选择值。 |
## 样式
除支持[通用样式](../arkui-js/js-components-common-styles.md)外,还支持如下样式:
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- |
| color | &lt;color&gt | \#ffffff | 否 | 候选项字体颜色。 |
| font-size | &lt;length&gt; | 16px | 否 | 候选项字体尺寸,类型length,单位px。 |
| selected-color | &lt;color&gt; | #ff0a69f7 | 否 | 选中项字体颜色。 |
| selected-font-size | &lt;length&gt; | 20px | 否 | 选中项字体尺寸,类型length,单位px。 |
| disappear-color<sup>5+</sup> | &lt;color&gt; | \#ffffff | 否 | 渐变消失项的字体颜色。消失项是在一列中有五个选项场景下最上和最下的两个选项。 |
| disappear-font-size<sup>5+</sup> | &lt;length&gt; | 14px | 否 | 渐变消失项的字体尺寸。消失项是在一列中有五个选项场景下最上和最下的两个选项。 |
| font-family | string | sans-serif | 否 | 选项字体类型。字体列表,用逗号分隔,每个字体用字体名或者字体族名设置。列表中第一个系统中存在的或者通过[自定义字体](../arkui-js/js-components-common-customizing-font.md)指定的字体,会被选中作为文本的字体。 |
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------------------------------- | -------------- | ---------- | ---- | ---------------------------------------- |
| color | &lt;color&gt | \#ffffff | 否 | 候选项字体颜色。 |
| font-size | &lt;length&gt; | 16px | 否 | 候选项字体尺寸,类型length,单位px。 |
| selected-color | &lt;color&gt; | #ff0a69f7 | 否 | 选中项字体颜色。 |
| selected-font-size | &lt;length&gt; | 20px | 否 | 选中项字体尺寸,类型length,单位px。 |
| disappear-color<sup>5+</sup> | &lt;color&gt; | \#ffffff | 否 | 渐变消失项的字体颜色。消失项是在一列中有五个选项场景下最上和最下的两个选项。 |
| disappear-font-size<sup>5+</sup> | &lt;length&gt; | 14px | 否 | 渐变消失项的字体尺寸。消失项是在一列中有五个选项场景下最上和最下的两个选项。 |
| font-family | string | sans-serif | 否 | 选项字体类型。字体列表,用逗号分隔,每个字体用字体名或者字体族名设置。列表中第一个系统中存在的或者通过[自定义字体](../arkui-js/js-components-common-customizing-font.md)指定的字体,会被选中作为文本的字体。 |
## 事件
......@@ -85,32 +85,32 @@
type=text:
| 名称 | 参数 | 描述 |
| -------- | -------- | -------- |
| 名称 | 参数 | 描述 |
| ------ | ---------------------------------------- | --------------- |
| change | {&nbsp;newValue:&nbsp;newValue,&nbsp;newSelected:&nbsp;newSelected&nbsp;} | 文本选择器选定值后触发该事件。 |
type=time:
| 名称 | 参数 | 描述 |
| -------- | -------- | -------- |
| 名称 | 参数 | 描述 |
| ------ | ---------------------------------------- | ------------------------------- |
| change | {&nbsp;hour:&nbsp;hour,&nbsp;minute:&nbsp;minute,&nbsp;[second:second]} | 时间选择器选定值后触发该事件。<br/>包含秒时,返回时分秒。 |
type=date:
| 名称 | 参数 | 描述 |
| -------- | -------- | -------- |
| 名称 | 参数 | 描述 |
| ------ | ---------------------------------------- | --------------- |
| change | {&nbsp;year:year,&nbsp;month:month,&nbsp;day:day&nbsp;} | 日期选择器选择值后触发该事件。 |
type=datetime:
| 名称 | 参数 | 描述 |
| -------- | -------- | -------- |
| 名称 | 参数 | 描述 |
| ------ | ---------------------------------------- | ----------------- |
| change | {&nbsp;year:year,&nbsp;month:month,&nbsp;day:day,&nbsp;&nbsp;hour:hour,&nbsp;minute:minute&nbsp;} | 日期时间选择器选择值后触发该事件。 |
type=multi-text:
| 名称 | 参数 | 描述 |
| -------- | -------- | -------- |
| 名称 | 参数 | 描述 |
| ------------ | ---------------------------------------- | ---------------------------------------- |
| columnchange | {&nbsp;column:column,&nbsp;newValue:newValue,&nbsp;newSelected:newSelected&nbsp;} | 多列文本选择器某一列的值改变时触发该事件,column:第几列修改,newValue:选中的值,newSelected:选中值对应的索引。 |
......
......@@ -24,9 +24,9 @@
除支持[通用属性](../arkui-js/js-components-common-attributes.md)外,还支持如下属性:
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- |
| type | string | default | 否 | list-item-group类型,同一list支持多种type的list-item-group,相同type的list-item-group需要确保渲染后的视图布局也完全相同,当type固定时,使用show属性代替if属性,确保视图布局不变。 |
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| ---- | ------ | ------- | ---- | ---------------------------------------- |
| type | string | default | 否 | list-item-group类型,同一list支持多种type的list-item-group,相同type的list-item-group需要确保渲染后的视图布局也完全相同,当type固定时,使用show属性代替if属性,确保视图布局不变。 |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
>
......@@ -37,21 +37,21 @@
除支持[通用样式](../arkui-js/js-components-common-styles.md)外,还支持如下样式:
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- |
| flex-direction | string | row | 否 | flex容器主轴方向。可选项有:<br/>-&nbsp;column:垂直方向从上到下<br/>-&nbsp;row:水平方向从左到右 |
| justify-content | string | flex-start | 否 | flex容器当前行的主轴对齐格式。可选项有:<br/>-&nbsp;flex-start:项目位于容器的开头。<br/>-&nbsp;flex-end:项目位于容器的结尾。<br/>-&nbsp;center:项目位于容器的中心。<br/>-&nbsp;space-between:项目位于各行之间留有空白的容器内。<br/>-&nbsp;space-around:项目位于各行之前、之间、之后都留有空白的容器内。<br/>-&nbsp;space-evenly<sup>5+</sup>:&nbsp;&nbsp;均匀排列每个元素,每个元素之间的间隔相等。 |
| 名称 | 类型 | 默认值 | 必填 | 描述 |
| --------------- | ------ | ---------- | ---- | ---------------------------------------- |
| flex-direction | string | row | 否 | flex容器主轴方向。可选项有:<br/>-&nbsp;column:垂直方向从上到下<br/>-&nbsp;row:水平方向从左到右 |
| justify-content | string | flex-start | 否 | flex容器当前行的主轴对齐格式。可选项有:<br/>-&nbsp;flex-start:项目位于容器的开头。<br/>-&nbsp;flex-end:项目位于容器的结尾。<br/>-&nbsp;center:项目位于容器的中心。<br/>-&nbsp;space-between:项目位于各行之间留有空白的容器内。<br/>-&nbsp;space-around:项目位于各行之前、之间、之后都留有空白的容器内。<br/>-&nbsp;space-evenly<sup>5+</sup>:&nbsp;&nbsp;均匀排列每个元素,每个元素之间的间隔相等。 |
## 事件
除支持[通用事件](../arkui-js/js-components-common-events.md)外,还支持如下事件:
| 名称 | 参数 | 描述 |
| -------- | -------- | -------- |
| groupclick | {&nbsp;groupid:&nbsp;string&nbsp;} | group点击事件。<br/>groupid:被点击的group的id。 |
| 名称 | 参数 | 描述 |
| ------------- | ---------------------------------- | ---------------------------------------- |
| groupclick | {&nbsp;groupid:&nbsp;string&nbsp;} | group点击事件。<br/>groupid:被点击的group的id。 |
| groupcollapse | {&nbsp;groupid:&nbsp;string&nbsp;} | group收拢事件。<br/>groupid:收拢的group的id。<br/>当不输入参数或者groupid为空时收拢所有分组。 |
| groupexpand | {&nbsp;groupid:&nbsp;string&nbsp;} | group展开事件。<br/>groupid:展开的group的id。<br/>当不输入参数或者groupid为空时展开所有分组。 |
| groupexpand | {&nbsp;groupid:&nbsp;string&nbsp;} | group展开事件。<br/>groupid:展开的group的id。<br/>当不输入参数或者groupid为空时展开所有分组。 |
## 方法
......
......@@ -39,7 +39,7 @@ export default {
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 针对数组内的数据修改,请使用splice方法生效数据绑定变更。
>
>
> - hml文件中的js表达式不支持ES6语法。
......@@ -185,7 +185,7 @@ Touch触摸类事件支持捕获,捕获阶段位于冒泡阶段之前,捕获
<div grab:touchstart.capture="touchstartfunc"></div>
</div>
```
```
// xxx.js
export default {
......@@ -247,9 +247,9 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 数组中的每个元素必须存在tid指定的数据属性,否则运行时可能会导致异常。
>
>
> - 数组中被tid指定的属性要保证唯一性,如果不是则会造成性能损耗。比如,示例中只有id和name可以作为tid字段,因为它们属于唯一字段。
>
>
> - tid不支持表达式。
......@@ -262,8 +262,8 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
<div class="container">
<button class="btn" type="capsule" value="toggleShow" onclick="toggleShow"></button>
<button class="btn" type="capsule" value="toggleDisplay" onclick="toggleDisplay"></button>
<text if="{{visible}}"> Hello-TV </text>
<text elif="{{display}}"> Hello-Wearable </text>
<text if="{{visible}}"> Hello-world1 </text>
<text elif="{{display}}"> Hello-world2 </text>
<text else> Hello-World </text>
</div>
```
......
......@@ -11,7 +11,7 @@
```
// Display only Hello Component1 on the PC preview. The content under MyComponent is displayed on the real device.
// Display only Hello Component1 on the preview. The content under MyComponent is displayed on the real device.
@Entry
@Component
struct MyComponent {
......
......@@ -101,9 +101,8 @@ export default {
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 智能穿戴仅支Input类型设置为button、radio、checkbox。
>
> - 仅当Input类型为checkbox和radio时,当前组件是否选中的属性checked才生效,默认值为false。
>
> 仅当Input类型为checkbox和radio时,当前组件是否选中的属性checked才生效,默认值为false。
## 事件绑定
......
......@@ -39,7 +39,7 @@ List是用来显示列表的组件,包含一系列相同宽度的列表项,
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - &lt;list-item-group&gt;是&lt;list&gt;的子组件,实现列表分组功能,不能再嵌套&lt;list&gt;,可以嵌套&lt;list-item&gt;。
>
>
> - &lt;list-item&gt;是&lt;list&gt;的子组件,展示列表的具体项。
......@@ -112,7 +112,7 @@ List是用来显示列表的组件,包含一系列相同宽度的列表项,
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - indexer属性生效需要flex-direction属性配合设置为column,且columns属性设置为1。
>
>
> - indexer可以自定义索引表,自定义时"\#"必须要存在。
......@@ -214,7 +214,7 @@ export default {
<div class="container">
<div class="in-container">
<text class="name">{{$item.name}}</text>
<text class="phone">18888888888</text>
<text class="number">18888888888</text>
</div>
</div>
</list-item>
......@@ -247,7 +247,7 @@ export default {
color: #000000;
font-size: 39px;
}
.phone {
.number {
color: black;
font-size: 25px;
}
......
......@@ -70,9 +70,8 @@ export default {
![zh-cn_image_0000001189098638](figures/zh-cn_image_0000001189098638.gif)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 普通选择器设置取值范围时,需要使用数据绑定的方式。
>
> - 日期选择器的lunarswitch属性只支持手机和平板设备。
>
> 普通选择器设置取值范围时,需要使用数据绑定的方式。
## 设置时间展现格式
......@@ -108,7 +107,7 @@ Picker的hours属性定义时间的展现格式,可选类型有12小时制和2
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - hours属性为12:按照12小时制显示,用上午和下午进行区分;
>
>
> - hours属性为24:按照24小时制显示。
......
......@@ -91,10 +91,10 @@ Slider组件通过color、selected-color、block-color样式分别为滑动条
![zh-cn_image_0000001179438692](figures/zh-cn_image_0000001179438692.gif)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> mode属性为滑动条样式,仅在手机和平板上生效,可选值为:
>
> mode属性为滑动条样式,可选值为:
>
> - outset:滑块在滑杆上;
>
>
> - inset:滑块在滑杆内。
......
......@@ -10,7 +10,7 @@ Text是文本组件,用于呈现一段文本信息。具体用法请参考[Tex
```
<!-- xxx.hml -->
<div class="container" style="text-align: center;justify-content: center; align-items: center;">
<text> Hello World </text>
<text>Hello World</text>
</div>
```
......@@ -33,184 +33,182 @@ Text是文本组件,用于呈现一段文本信息。具体用法请参考[Tex
- 添加文本样式
设置color、font-size、allow-scale、word-spacing、text-valign属性分别为文本添加颜色、大小、缩放、文本之间的间距和文本在垂直方向的对齐方式。
设置color、font-size、allow-scale、word-spacing、text-valign属性分别为文本添加颜色、大小、缩放、文本之间的间距和文本在垂直方向的对齐方式。
```
<!-- xxx.hml -->
<div class="container" style="background-color:#F1F3F5;flex-direction: column;justify-content: center; align-items: center;">
<text style="color: blueviolet; font-size: 40px; allow-scale:true">
This is a passage
</text>
<text style="color: blueviolet; font-size: 40px; margin-top: 20px; allow-scale:true;word-spacing: 20px;" >
This is a passage
</text>
</div>
```
```
/* xxx.css */
.container {
width: 100%;
height: 100%;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #F1F3F5;
}
```
```
<!-- xxx.hml -->
<div class="container" style="background-color:#F1F3F5;flex-direction: column;justify-content: center; align-items: center;">
<text style="color: blueviolet; font-size: 40px; allow-scale:true">
This is a passage
</text>
<text style="color: blueviolet; font-size: 40px; margin-top: 20px; allow-scale:true;word-spacing: 20px;" >
This is a passage
</text>
</div>
```
```
/* xxx.css */
.container {
width: 100%;
height: 100%;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #F1F3F5;
}
```
![zh-cn_image_0000001220778205](figures/zh-cn_image_0000001220778205.png)
![zh-cn_image_0000001220778205](figures/zh-cn_image_0000001220778205.png)
- 添加划线
设置text-decoration和text-decoration-colo属性为文本添加划线和划线颜色,text-decoration枚举值请参考 Text自有样式。
设置text-decoration和text-decoration-colo属性为文本添加划线和划线颜色,text-decoration枚举值请参考 Text自有样式。
<!-- xxx.hml -->
<div class="container" style="background-color:#F1F3F5;">
<text style="text-decoration:underline">
This is a passage
</text>
<text style="text-decoration:line-through;text-decoration-color: red">
This is a passage
</text>
</div>
```
/* xxx.css */
.container {
width: 100%;
height: 100%;
flex-direction: column;
align-items: center;
justify-content: center;
}
text{
font-size: 50px;
}
```
```
<!-- xxx.hml -->
<div class="container" style="background-color:#F1F3F5;">
<text style="text-decoration:underline">
This is a passage
</text>
<text style="text-decoration:line-through;text-decoration-color: red">
This is a passage
</text>
</div>
```
```
/* xxx.css */
.container {
width: 100%;
height: 100%;
flex-direction: column;
align-items: center;
justify-content: center;
}
text{
font-size: 50px;
}
```
![zh-cn_image_0000001220856725](figures/zh-cn_image_0000001220856725.png)
- 隐藏文本内容
当文本内容过多而显示不全时,添加text-overflow属性将隐藏内容以省略号的形式展现
```
<!-- xxx.hml -->
<div class="container">
<text class="text">
This is a passage
</text>
</div>
```
/* xxx.css */
.container {
width: 100%;
height: 100%;
flex-direction: column;
align-items: center;
background-color: #F1F3F5;
justify-content: center;
}
.text{
width: 200px;
max-lines: 1;
text-overflow:ellipsis;
}
- 隐藏文本内容
**说明:**
当文本内容过多而显示不全时,添加text-overflow属性将隐藏内容以省略号的形式展现。
- text-overflow样式需要与max-lines样式配套使用,设置了最大行数的情况下生效。
- max-lines属性设置文本最多可以展示的行数。
```
<!-- xxx.hml -->
<div class="container">
<text class="text">
This is a passage
</text>
</div>
```
```
/* xxx.css */
.container {
width: 100%;
height: 100%;
flex-direction: column;
align-items: center;
background-color: #F1F3F5;
justify-content: center;
}
.text{
width: 200px;
max-lines: 1;
text-overflow:ellipsis;
}
```
> **说明:**
> - text-overflow样式需要与max-lines样式配套使用,设置了最大行数的情况下生效。
> - max-lines属性设置文本最多可以展示的行数。
​ ![zh-cn_image_0000001163656706](figures/zh-cn_image_0000001163656706.png)
​ ![zh-cn_image_0000001163656706](figures/zh-cn_image_0000001163656706.png)
- 设置文本折行
设置word-break属性对文本内容做断行处理,word-break枚举值请参考Text自有样式。
设置word-break属性对文本内容做断行处理,word-break枚举值请参考Text自有样式。
```
<!-- xxx.hml -->
<div class="container">
<div class="content">
<text class="text1">
Welcome to the world
</text>
<text class="text2">
```
<!-- xxx.hml -->
<div class="container">
<div class="content">
<text class="text1">
Welcome to the world
</text>
<text class="text2">
Welcome to the world
</text>
</div>
</div>
</div
```
```
```
/* xxx.css */
.container {
background-color: #F1F3F5;
flex-direction: column;
align-items: center;
justify-content: center;
}
.content{
width: 50%;
flex-direction: column;
align-items: center;
justify-content: center;
}
.text1{
height: 200px;
border:1px solid #1a1919;
margin-bottom: 50px;
text-align: center;
word-break: break-word;
font-size: 40px;
}
.text2{
height: 200px;
border:1px solid #0931e8;
text-align: center;
word-break: break-all;
font-size: 40px;
}
```
/* xxx.css */
.container {
background-color: #F1F3F5;
flex-direction: column;
align-items: center;
justify-content: center;
}
.content{
width: 50%;
flex-direction: column;
align-items: center;
justify-content: center;
}
.text1{
height: 200px;
border:1px solid #1a1919;
margin-bottom: 50px;
text-align: center;
word-break: break-word;
font-size: 40px;
}
.text2{
height: 200px;
border:1px solid #0931e8;
text-align: center;
word-break: break-all;
font-size: 40px;
}
​ ![zh-cn_image_0000001209033195](figures/zh-cn_image_0000001209033195.png)
​ ![zh-cn_image_0000001209033195](figures/zh-cn_image_0000001209033195.png)
- Text组件支持[Span](../reference/arkui-js/js-components-basic-span.md)子组件
```
<!-- xxx.hml -->
<div class="container" style="justify-content: center; align-items: center;flex-direction: column;background-color: #F1F3F5; width: 100%;height: 100%;">
<text style="font-size: 45px;">
This is a passage
</text>
<text style="font-size: 45px;">
<span style="color: aqua;">This </span><span style="color: #F1F3F5;"> 1
</span>
<span style="color: blue;"> is a </span> <span style="color: #F1F3F5;"> 1 </span>
<span style="color: red;"> passage </span>
</text>
</div>
```
![zh-cn_image_0000001163372568](figures/zh-cn_image_0000001163372568.png)
```
<!-- xxx.hml -->
<div class="container" style="justify-content: center; align-items: center;flex-direction: column;background-color: #F1F3F5; width: 100%;height: 100%;">
<text style="font-size: 45px;">
This is a passage
</text>
<text style="font-size: 45px;">
<span style="color: aqua;">This </span><span style="color: #F1F3F5;"> 1
</span>
<span style="color: blue;"> is a </span> <span style="color: #F1F3F5;"> 1 </span>
<span style="color: red;"> passage </span>
</text>
</div>
```
![zh-cn_image_0000001163372568](figures/zh-cn_image_0000001163372568.png)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 当使用Span子组件组成文本段落时,如果Span属性样式异常(例如:font-weight设置为1000),将导致文本段落显示异常。
>
>
> - 在使用Span子组件时,注意Text组件内不能存在文本内容,如果存在文本内容也只会显示子组件Span里的内容。
## 场景示例
......
......@@ -20,7 +20,7 @@
Seafood,
Dessert
}
let NextId = 0;
class FoodData {
id: string;
......@@ -32,7 +32,7 @@
fat: number;
carbohydrates: number;
vitaminC: number;
constructor(name: string, image: Resource, category: Category, calories: number, protein: number, fat: number, carbohydrates: number, vitaminC: number) {
this.id = `${ NextId++ }`;
this.name = name;
......@@ -47,8 +47,8 @@
}
```
3. 存入食物图片资源。在resources &gt; phone &gt; media目录下存入食物图片资源,图片名称为食物名称。
3. 存入食物图片资源。在resources &gt;base&gt; media目录下存入食物图片资源,图片名称为食物名称。
4. 创建食物资源数据。在model文件夹下创建FoodDataModels.ets,在该页面中声明食物成分数组FoodComposition。
实际开发中,开发者可以自定义更多的数据资源,当食物资源很多时,建议使用数据懒加载LazyForEach。
......@@ -63,7 +63,7 @@
}
// FoodDataModels.ets
import { Category, FoodData } from './FoodData'
export function initializeOnStartup(): Array<FoodData> {
let FoodDataArray: Array<FoodData> = []
FoodComposition.forEach(item => {
......
......@@ -14,14 +14,14 @@
![zh-cn_image_0000001168059158](figures/zh-cn_image_0000001168059158.png)
4. 进入配置工程界面,将工程名字改为HealthyDiet,Project Type选择Application,Compile API选择8,UI Syntax选择eTS。DevEco Studio会默认将工程保存在C盘,如果要更改工程保存位置,点击Save Location的文件夹图标,自行指定工程创建位置。配置完成后点击Finish。
3. 进入配置工程界面,将工程名字改为HealthyDiet,Project Type选择Application,Compile API选择8,UI Syntax选择eTS。DevEco Studio会默认将工程保存在C盘,如果要更改工程保存位置,点击Save Location的文件夹图标,自行指定工程创建位置。配置完成后点击Finish。
![zh-cn_image_0000001167746622](figures/zh-cn_image_0000001167746622.png)
5. 工程创建完成后,打开app.ets。
4. 工程创建完成后,打开app.ets。
app.ets提供了应用生命周期的接口:onCreate和onDestroy,分别在应用创建之初和应用被销毁时调用。在app.ets里可以声明全局变量,并且声明的数据和方法是整个应用共享的。
```
export default {
onCreate() {
......@@ -32,8 +32,8 @@
},
}
```
6. 在工程导航栏里,打开index.ets。该页面展示了当前的UI描述,声明式UI框架会自动生成一个组件化的struct,这个struct遵循Builder接口声明,在build方法里面声明当前的布局和组件。
5. 在工程导航栏里,打开index.ets。该页面展示了当前的UI描述,声明式UI框架会自动生成一个组件化的struct,这个struct遵循Builder接口声明,在build方法里面声明当前的布局和组件。
```
@Entry
@Component
......@@ -50,14 +50,16 @@
}
```
7. 点击右侧的Previewer按钮,打开预览窗口。可以看到在手机设备类型的预览窗口中“Hello World”居中加粗显示。
6. 点击右侧的Previewer按钮,打开预览窗口。可以看到预览窗口中“Hello World”居中加粗显示。
如果没有Previewer按钮,点击settings &gt; SDK Manager &gt; OpenHarmony SDK&gt; Tools 查看是否安装了Previewer。
![zh-cn_image_0000001214595111](figures/zh-cn_image_0000001214595111.png)
8. 应用安装到手机上运行应用。将手机连接电脑,等IDE识别到物理设备后,点击Run 'entry'按钮。
7. 应用安装到设备上运行应用。
将设备连接电脑,等IDE识别到物理设备后,点击Run 'entry'按钮。
![zh-cn_image_0000001148858818](figures/zh-cn_image_0000001148858818.png)
在安装之前,需要[配置应用签名](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-debugging-and-running-0000001263040487#section17660437768)。安装成功后,点击屏幕上的Run图标打开应用,可以看到居中加粗显示的“Hello World”。
在安装之前,需要配置应用签名。安装成功后,点击屏幕上的Run图标打开应用,可以看到居中加粗显示的“Hello World”。
![zh-cn_image_0000001158896538](figures/zh-cn_image_0000001158896538.png)
......@@ -43,15 +43,9 @@
![zh-cn_image_0000001168410342](figures/zh-cn_image_0000001168410342.png)
3. 通过资源访问图片。
除指定图片路径外,也可以使用引用媒体资源符$r引用资源,需要遵循resources文件夹的资源限定词的规则。右键resources文件夹,点击New&gt;Resource Directory,选择Resource Type为Media(图片资源),选择资源限定词为Device-Phone(目前开发设备为手机)
除指定图片路径外,也可以使用引用媒体资源符$r引用资源,需要遵循resources文件夹的资源限定词的规则。右键resources文件夹,点击New&gt;Resource Directory,选择Resource Type为Media(图片资源)。
![zh-cn_image_0000001168570318](figures/zh-cn_image_0000001168570318.png)
点击OK后,resources文件夹下生成phone文件夹,phone文件夹下生成media文件夹,将Tomato.png放入media文件夹内。
![zh-cn_image_0000001214330169](figures/zh-cn_image_0000001214330169.png)
就可以通过`$r('app.type.name')`的形式引用应用资源,即`$r('app.media.Tomato')`
将Tomato.png放入media文件夹内。就可以通过`$r('app.type.name')`的形式引用应用资源,即`$r('app.media.Tomato')`
```
@Entry
......
......@@ -50,7 +50,7 @@
2. 点击FoodGridItem后跳转到FoodDetail页面。调用页面路由router模块的push接口,将FoodDetail页面推到路由栈中,实现页面跳转。使用router路由API接口,需要先引入router。
```
import router from '@system.router'
@Component
struct FoodGridItem {
private foodItem: FoodData
......@@ -69,11 +69,11 @@
![zh-cn_image_0000001169918548](figures/zh-cn_image_0000001169918548.gif)
3. 在FoodDetail页面增加回到食物列表页面的图标。在resources &gt; phone &gt; media文件夹下存入回退图标Back.png。新建自定义组件PageTitle,包含后退的图标和Food Detail的文本,调用路由的router.back()接口,弹出路由栈最上面的页面,即返回上一级页面。
3. 在FoodDetail页面增加回到食物列表页面的图标。在resources &gt; base &gt; media文件夹下存入回退图标Back.png。新建自定义组件PageTitle,包含后退的图标和Food Detail的文本,调用路由的router.back()接口,弹出路由栈最上面的页面,即返回上一级页面。
```
// FoodDetail.ets
import router from '@system.router'
@Component
struct PageTitle {
build() {
......@@ -148,7 +148,7 @@
```
// FoodDetail.ets
import { FoodData } from '../model/FoodData'
@Entry
@Component
struct FoodDetail {
......@@ -165,7 +165,7 @@
@Component
struct FoodDetail {
private foodItem: FoodData = router.getParams().foodData
build() {
......
}
......@@ -193,7 +193,7 @@
})
}
}
@Component
struct FoodImageDisplay {
private foodItem: FoodData
......@@ -210,11 +210,11 @@
.backgroundColor('#FFedf2f5')
}
}
@Component
struct ContentTable {
private foodItem: FoodData
@Builder IngredientItem(title:string, name: string, value: string) {
Flex() {
Text(title)
......@@ -231,7 +231,7 @@
.layoutWeight(2)
}
}
build() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Start }) {
this.IngredientItem('Calories', 'Calories', this.foodItem.calories + 'kcal')
......@@ -244,12 +244,12 @@
.padding({ top: 30, right: 30, left: 30 })
}
}
@Entry
@Component
struct FoodDetail {
private foodItem: FoodData = router.getParams().foodData
build() {
Column() {
Stack( { alignContent: Alignment.TopStart }) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册