提交 ff7dad86 编写于 作者: H HelloCrease

update docs

Signed-off-by: NHelloCrease <lian15@huawei.com>
上级 3bb429cb
# Sensor Overview # Sensor Overview
Sensors in OpenHarmony are an abstraction of underlying hardware-based sensors. Your application can access the underlying sensors via OpenHarmony sensors. Using the APIs provided by OpenHarmony sensors, you can query sensors on your device, subscribe to sensor data, customize algorithms based on sensor data, and develop various sensor-based applications, such as compass, fitness and health, and games applications. Sensors in OpenHarmony are an abstraction of underlying hardware-based sensors. Your application can access the underlying sensors via the sensors. Using the APIs provided by sensors, you can query sensors on your device, subscribe to sensor data, customize algorithms based on sensor data, and develop various sensor-based applications, such as compass, fitness and health, and games applications.
The sensors are classified into the following categories based on their functions: motion, environment, orientation, light, body, and other categories (such as Hall effect sensors). Each category includes different sensor types. A sensor type may be a single physical sensor or a composite of multiple physical sensors. A sensor is a device to detect events or changes in an environment and send messages about the events or changes to another device (for example, a CPU). Generally, a sensor is composed of sensitive components and conversion components. Sensors are the cornerstone of the IoT. A unified sensor management framework is required to achieve data sensing at a low latency and low power consumption, thereby keeping up with requirements of "1+8+N" products or business in the Seamless AI Life Strategy. The sensor list is as follows:
| Sensor Type | Sensor Name | Description | Usage |
| --------------------------------------- | ------------------ | ------------------------------------------------------------ | ---------------------------------------- |
| SENSOR_TYPE_ACCELEROMETER | Acceleration sensor | Measures the acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>.| Detecting the motion status |
| SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED | Uncalibrated acceleration sensor| Measures the uncalibrated acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>.| Measuring the acceleration bias estimation |
| SENSOR_TYPE_LINEAR_ACCELERATION | Linear acceleration sensor | Measures the linear acceleration (excluding the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>.| Detecting the linear acceleration in each axis |
| SENSOR_TYPE_GRAVITY | Gravity sensor | Measures the gravity acceleration applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>.| Measuring the gravity |
| SENSOR_TYPE_GYROSCOPE | Gyroscope sensor | Measures the rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s.| Measuring the rotation angular velocity |
| SENSOR_TYPE_GYROSCOPE_UNCALIBRATED | Uncalibrated gyroscope sensor| Measures the uncalibrated rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s.| Measuring the bias estimation of the rotation angular velocity |
| SENSOR_TYPE_SIGNIFICANT_MOTION | Significant motion sensor | Checks whether a device has a significant motion on three physical axes (X, Y, and Z). The value **0** means that the device does not have a significant motion, and **1** means the opposite.| Detecting significant motions of a device |
| SENSOR_TYPE_PEDOMETER_DETECTION | Pedometer detection sensor | Detects whether a user takes a step. The value can be **0** (the user does not take a step) or **1** (the user takes a step).| Detecting whether a user takes a step |
| SENSOR_TYPE_PEDOMETER | Pedometer sensor | Records the number of steps a user has walked. | Providing the number of steps a user has walked |
| SENSOR_TYPE_AMBIENT_TEMPERATURE | Ambient temperature sensor | Measures the ambient temperature, in the unit of degree Celsius (°C). | Measuring the ambient temperature |
| SENSOR_TYPE_MAGNETIC_FIELD | Magnetic field sensor | Measures the magnetic field on three physical axes (X, Y, and Z), in the unit of μT.| Creating a compass |
| SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | Uncalibrated magnetic field sensor | Measures the uncalibrated magnetic field on three physical axes (X, Y, and Z), in the unit of μT.| Measuring the magnetic field bias estimation |
| SENSOR_TYPE_HUMIDITY | Humidity sensor | Measures the ambient relative humidity, in a percentage (%). | Monitoring the dew point, absolute humidity, and relative humidity |
| SENSOR_TYPE_BAROMETER | Barometer sensor | Measures the barometric pressure, in the unit of hPa or mbar. | Measuring the barometric pressure |
| SENSOR_TYPE_ORIENTATION | Orientation sensor | Measures the rotation angles of a device on three physical axes (X, Y, and Z), in the unit of rad.| Providing the three orientation angles of the screen |
| SENSOR_TYPE_ROTATION_VECTOR | Rotation vector sensor | Measures the rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor, magnetic field sensor, and gyroscope sensor.| Detecting the orientation of a device in the East, North, Up (ENU) Cartesian coordinate system |
| SENSOR_TYPE_PROXIMITY | Proximity sensor | Measures the distance between a visible object and the device screen. | Measuring the distance between a person and the device during a call |
| SENSOR_TYPE_AMBIENT_LIGHT | Ambient light sensor | Measures the ambient light intensity of a device, in the unit of lux. | Automatically adjusting the screen brightness and checking whether the screen is covered on the top|
| SENSOR_TYPE_HEART_RATE | Heart rate sensor | Measures the heart rate of a user. | Providing users' heart rate data |
| SENSOR_TYPE_WEAR_DETECTION | Wear detection sensor | Checks whether a user is wearing a wearable device. | Detecting wearables |
| SENSOR_TYPE_HALL | Hall effect sensor | Detects a magnetic field around a device. | Smart cover mode of the device |
**Table1** Motion - ohos.sensor.agent.CategoryMotionAgent
| Sensor Type | Sensor Name | Description | Usage | ## Working Principles
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_ACCELEROMETER | Acceleration sensor | Measures the acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Detecting the motion status |
| SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED | Uncalibrated acceleration sensor | Measures the uncalibrated acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Measuring the acceleration bias estimation |
| SENSOR_TYPE_LINEAR_ACCELERATION | Linear acceleration sensor | Measures the linear acceleration (excluding the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Detecting the linear acceleration in each axis |
| SENSOR_TYPE_GRAVITY | Gravity sensor | Measures the gravity acceleration applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Measuring the gravity |
| SENSOR_TYPE_GYROSCOPE | Gyroscope sensor | Measures the rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s. | Measuring the rotation angular velocity |
| SENSOR_TYPE_GYROSCOPE_UNCALIBRATED | Uncalibrated gyroscope sensor | Measures the uncalibrated rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s. | Measuring the bias estimation of the rotation angular velocity |
| SENSOR_TYPE_SIGNIFICANT_MOTION | Significant motion sensor | Checks whether a device has a significant motion on three physical axes (X, Y, and Z). The value can be **0** (having no significant motion) or **1** (having a significant motion). | Detecting significant motions of a device |
| SENSOR_TYPE_DROP_DETECTION | Drop detection sensor | Detects the device drop status. The value can be **0** (the device is not dropped) or **1** (the device is dropped). | Detecting whether a device is dropped |
| SENSOR_TYPE_PEDOMETER_DETECTION | Pedometer detection sensor | Detects whether a user takes a step. The value can be **0** (the user does not take a step) or **1** (the user takes a step). | Detecting whether a user takes a step |
| SENSOR_TYPE_PEDOMETER | Pedometer sensor | Records the number of steps a user has walked. | Providing the number of steps a user has walked |
The following modules work cooperatively to implement OpenHarmony sensors: Sensor API, Sensor Framework, Sensor Service, and HDF layer.
**Table2** Environment - ohos.sensor.agent.CategoryOrientationAgent **Figure 1** How the sensor works
| Sensor Type | Sensor Name | Description | Usage | ![fad1a124-a90e-460f-84fc-e87d6caebb21](figures/fad1a124-a90e-460f-84fc-e87d6caebb21.png)
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_AMBIENT_TEMPERATURE | Ambient temperature sensor. | Measures the ambient temperature, in the unit of degree Celsius (°C). | Measuring the ambient temperature |
| SENSOR_TYPE_MAGNETIC_FIELD | Magnetic field sensor | Measures the magnetic field on three physical axes (X, Y, and Z), in the unit of μT. | Creating a compass |
| SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | Uncalibrated magnetic field sensor | Measures the uncalibrated magnetic field on three physical axes (X, Y, and Z), in the unit of μT. | Measuring the magnetic field bias estimation |
| SENSOR_TYPE_HUMIDITY | Humidity sensor | Measures the ambient relative humidity, in a percentage (%). | Monitoring the dew point, absolute humidity, and relative humidity |
| SENSOR_TYPE_BAROMETER | Barometer sensor | Measures the barometric pressure, in the unit of hPa or mbar. | Measuring the barometric pressure |
| SENSOR_TYPE_SAR | Specific Absorption Rate (SAR) sensor | Measures the SAR, in the unit of W/kg. | Measuring the SAR of electromagnetic waves for a device |
**Table3** Orientation - ohos.sensor.agent.CategoryOrientationAgent
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_6DOF | Degrees of Freedom (DoF) sensor | Measures the forward/backward, up/down, and left/right translational movement of a device on the three axes (X, Y, and Z) in the unit of m or mm as well as the roll, pitch, and yaw rotation angles on the three axes (X, Y, and Z) in the unit of rad. | Positioning an object by detecting its freedom of translational and rotational motions, for example, VR |
| SENSOR_TYPE_SCREEN_ROTATION | Screen rotation sensor | Checks the rotation status of the device screen. | Detecting whether the device screen is rotating |
| SENSOR_TYPE_DEVICE_ORIENTATION | Device orientation sensor | Measures the rotation angles of the device, in the unit of rad. | Measuring the angles that a device has rotated |
| SENSOR_TYPE_ORIENTATION | Orientation sensor | Measures the rotation angles of a device on three physical axes (X, Y, and Z), in the unit of rad. | Providing the three orientation angles of the screen |
| SENSOR_TYPE_ROTATION_VECTOR | Rotation vector sensor | Measures the rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor, magnetic field sensor, and gyroscope sensor. | Detecting the orientation of a device in the East, North, Up (ENU) Cartesian coordinate system |
| SENSOR_TYPE_GAME_ROTATION_VECTOR<br/>SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR | Game rotation vector sensor<br/>Geomagnetic rotation vector sensor | Measures the game rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor and gyroscope sensor.<br/>Measures the geomagnetic rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor and magnetic field sensor. | Applied in games<br/>Measuring the geomagnetic rotation vector |
**Table4** Light - ohos.sensor.agent.CategoryLightAgent
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_PROXIMITY | Proximity sensor | Measures the distance between a visible object and the device screen. | Measuring the distance between a person and the device during a call |
| SENSOR_TYPE_TOF | Time of flight (ToF) sensor | Measures the time required for light to travel a distance in the medium. | Facial recognition |
| SENSOR_TYPE_AMBIENT_LIGHT | Ambient light sensor | Measures the ambient light intensity of a device, in the unit of lux. | Automatically adjusting the screen brightness and checking whether the screen is covered on the top |
| SENSOR_TYPE_COLOR_TEMPERATURE | Color temperature sensor | Measures the ambient color temperature. | Image processing on the device |
| SENSOR_TYPE_COLOR_RGB | RGB color sensor | Measures the ambient RGB color values. | Color detection implemented by the reflectance of RGB colors |
| SENSOR_TYPE_COLOR_XYZ | XYZ color sensor | Measures the ambient XYZ color values. | Identifying true-color spots to reproduce more natural colors |
**Table5** Body - ohos.sensor.agent.CategoryBodyAgent
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_HEART_RATE | Heart rate sensor | Measures the heart rate of a user. | Providing users' heart rate data |
| SENSOR_TYPE_WEAR_DETECTION | Wear detection sensor | Checks whether a user is wearing a wearable device. | Detecting wearables |
**Table6** Others
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_HALL | Hall effect sensor | Detects a magnetic field around a device. | Smart cover mode of the device |
| SENSOR_TYPE_GRIP_DETECTOR | Grip detection sensor | Detects grip force applied on a device. | Detecting whether the device is gripped on its sides |
| SENSOR_TYPE_MAGNET_BRACKET | Magnet bracket sensor | Checks whether a device is magnetized. | Detecting an in-vehicle or indoor device |
| SENSOR_TYPE_PRESSURE_DETECTOR | Pressure detection sensor | Detects pressure force applied on a device. | Detecting pressure on the top of the device |
## How a Service Is Shared Using Huawei Share
The following modules work cooperatively to implement OpenHarmony sensors: Sensor API, Sensor Framework, Sensor Service, and HD_IDL.
**Figure1** Working principles for OpenHarmony sensors
![en-us_image_0000001226521897](figures/en-us_image_0000001226521897.png)
- Sensor API: provides APIs for performing basic operations on sensors, including querying the sensor list, subscribing to or unsubscribing from sensor data, and executing control commands. This module makes application development simpler. - Sensor API: provides APIs for performing basic operations on sensors, including querying the sensor list, subscribing to or unsubscribing from sensor data, and executing control commands. This module makes application development simpler.
...@@ -90,22 +45,22 @@ The following modules work cooperatively to implement OpenHarmony sensors: Senso ...@@ -90,22 +45,22 @@ The following modules work cooperatively to implement OpenHarmony sensors: Senso
- Sensor Service: interacts with the HD_IDL module to receive, parse, and distribute data, manages foreground and background policies and sensors of a device, and controls sensor permissions. - Sensor Service: interacts with the HD_IDL module to receive, parse, and distribute data, manages foreground and background policies and sensors of a device, and controls sensor permissions.
- HD_IDL: selects proper policies based on the hardware first in first out (FIFO) and frequency, and adapts to different devices. - HDF layer: selects proper policies based on the hardware first in first out (FIFO) and frequency, and adapts to different devices.
## Limitations and Constraints ## Constraints
To obtain data of the following sensors, you must claim the required permissions. 1. To obtain data of the following sensors, you must claim the required permissions.
Table 7 Sensor data permissions
**Table7** Sensor data permission | Sensor | Permission | Sensitivity | Permission Description |
| ------------------------- | -------------------------------- | ------------ | ----------------------- |
| Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor| ohos.permission.ACCELEROMETER | system_grant | Allows your application to subscribe to data of these acceleration-related sensors in the motion category.|
| Gyroscope sensor and uncalibrated gyroscope sensor | ohos.permission.GYROSCOPE | system_grant | Allows an application to subscribe to data of the gyroscope-related sensors in the motion category.|
| Pedometer sensor | ohos.permission.ACTIVITY_MOTION | user_grant | Allows an application to subscribe to the motion status. |
| Heart rate sensor | ohos.permission.READ_HEALTH_DATA | user_grant | Allows an application to read health data. |
| Sensor | Permission Name | Sensitivity | Permission Description |
| -------- | -------- | -------- | -------- |
| Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor | ohos.permission.ACCELEROMETER | system_grant | Allows your application to subscribe to data of these acceleration-related sensors in the motion category. |
| Gyroscope sensor and uncalibrated gyroscope sensor | ohos.permission.GYROSCOPE | system_grant | Allows your application to subscribe to data of these gyroscope-related sensors in the motion category. |
| Pedometer sensor | ohos.permission.ACTIVITY_MOTION | user_grant | Allows your application to subscribe to the motion status. |
| Heart rate sensor | ohos.permission.READ_HEALTH_DATA | user_grant | Allows your application to read health data. |
The APIs for subscribing to and unsubscribing from sensor data work in pairs. If you do not need sensor data, call the unsubscription API to stop sensor data reporting. 2. The APIs for subscribing to and unsubscribing from sensor data work in pairs. If you do not need sensor data, call the unsubscription API to stop sensor data reporting.
...@@ -22,15 +22,15 @@ The default duration of delayed suspension is 180000 when the battery level is h ...@@ -22,15 +22,15 @@ The default duration of delayed suspension is 180000 when the battery level is h
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------------------- | --------- | ---------------------------------------- |
| reason | string | Yes| Reason for delayed transition to the suspended state.| | reason | string | Yes | Reason for delayed transition to the suspended state. |
| callback | Callback&lt;void&gt; | 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.| | callback | Callback&lt;void&gt; | 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** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------------------------- | --------------------------------------- |
| [DelaySuspendInfo](#delaysuspendinfo) | Information about the suspension delay.| | [DelaySuspendInfo](#delaysuspendinfo) | Information about the suspension delay. |
**Example** **Example**
```js ```js
...@@ -50,12 +50,13 @@ Obtains the remaining duration before the application is suspended. This API use ...@@ -50,12 +50,13 @@ Obtains the remaining duration before the application is suspended. This API use
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | --------- | --------------------------- | --------- | ---------------------------------------- |
| requestId | number | Yes| ID of the suspension delay request.| | requestId | number | Yes | ID of the suspension delay request. |
| callback | AsyncCallback&lt;number&gt; | Yes| Callback used to return the remaining duration before the application is suspended, in milliseconds.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the remaining duration before the application is suspended, in milliseconds. |
**Example** **Example**
```js ```js
let id = 1; let id = 1;
backgroundTaskManager.getRemainingDelayTime(id, (err, res) => { backgroundTaskManager.getRemainingDelayTime(id, (err, res) => {
...@@ -77,14 +78,14 @@ Obtains the remaining duration before the application is suspended. This API use ...@@ -77,14 +78,14 @@ Obtains the remaining duration before the application is suspended. This API use
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | --------- | ------ | --------- | ----------------------------------- |
| requestId | number | Yes| ID of the suspension delay request.| | requestId | number | Yes | ID of the suspension delay request. |
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | --------------------- | ---------------------------------------- |
| Promise&lt;number&gt; | Promise used to return the remaining duration before the application is suspended, in milliseconds.| | Promise&lt;number&gt; | Promise used to return the remaining duration before the application is suspended, in milliseconds. |
**Example** **Example**
```js ```js
...@@ -106,9 +107,9 @@ Cancels the suspension delay. ...@@ -106,9 +107,9 @@ Cancels the suspension delay.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | --------- | ------ | --------- | ----------------------------------- |
| requestId | number | Yes| ID of the suspension delay request.| | requestId | number | Yes | ID of the suspension delay request. |
**Example** **Example**
```js ```js
...@@ -127,12 +128,12 @@ Requests a continuous task from the system. This API uses an asynchronous callba ...@@ -127,12 +128,12 @@ Requests a continuous task from the system. This API uses an asynchronous callba
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | --------- | ---------------------------------- | --------- | ---------------------------------------- |
| context | [Context](js-apis-Context.md) | Yes| Application context.| | context | [Context](js-apis-Context.md) | Yes | Application context. |
| bgMode | [BackgroundMode](#backgroundmode8) | Yes| Background mode requested.| | bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-notification.md#WantAgent)| Yes| Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked.| | 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&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example** **Example**
```js ```js
...@@ -178,17 +179,17 @@ Requests a continuous task from the system. This API uses a promise to return th ...@@ -178,17 +179,17 @@ Requests a continuous task from the system. This API uses a promise to return th
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | --------- | ---------------------------------- | --------- | ---------------------------------------- |
| context | [Context](js-apis-Context.md) | Yes| Application context.| | context | [Context](js-apis-Context.md) | Yes | Application context. |
| bgMode | [BackgroundMode](#backgroundmode8) | Yes| Background mode requested.| | bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-notification.md#WantAgent)| Yes| Notification parameter, which is used to specify the target page when a continuous task notification is clicked.| | 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** **Return value**
| Type | Description | | Type | Description |
| -------------- | ------------------------- | | -------------- | ---------------------------------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result. |
**Example** **Example**
```js ```js
...@@ -225,15 +226,13 @@ stopBackgroundRunning(context: Context, callback: AsyncCallback&lt;void&gt;): vo ...@@ -225,15 +226,13 @@ stopBackgroundRunning(context: Context, callback: AsyncCallback&lt;void&gt;): vo
Requests to cancel a continuous task. This API uses an asynchronous callback to return the result. Requests to cancel a continuous task. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.KEEP_BACKGROUND_RUNNING
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ----------------------------- | --------- | ----------------------------------- |
| context | [Context](js-apis-Context.md) | Yes| Application context.| | context | [Context](js-apis-Context.md) | Yes | Application context. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example** **Example**
```js ```js
...@@ -258,19 +257,17 @@ stopBackgroundRunning(context: Context): Promise&lt;void&gt; ...@@ -258,19 +257,17 @@ stopBackgroundRunning(context: Context): Promise&lt;void&gt;
Requests to cancel a continuous task. This API uses a promise to return the result. Requests to cancel a continuous task. This API uses a promise to return the result.
**Required permissions**: ohos.permission.KEEP_BACKGROUND_RUNNING
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | ----------------------------- | --------- | -------------------- |
| context | [Context](js-apis-Context.md) | Yes| Application context.| | context | [Context](js-apis-Context.md) | Yes | Application context. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ------------------------- | | -------------- | ---------------------------------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result. |
**Example** **Example**
```js ```js
...@@ -291,24 +288,24 @@ Provides the information about the suspension delay. ...@@ -291,24 +288,24 @@ Provides the information about the suspension delay.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | --------------- | ------ | --------- | ---------------------------------------- |
| requestId | number | Yes| ID of the suspension delay request.| | 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.| | 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> ## BackgroundMode<sup>8+</sup>
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
| Name | Value| Description| | Name | Value | Description |
| ----------------------- | -------- | -------- | | ----------------------- | ----- | -------------------------------- |
| DATA_TRANSFER | 1 | Data transfer.| | DATA_TRANSFER | 1 | Data transfer. |
| AUDIO_PLAYBACK | 2 | Audio playback.| | AUDIO_PLAYBACK | 2 | Audio playback. |
| AUDIO_RECORDING | 3 | Audio recording.| | AUDIO_RECORDING | 3 | Audio recording. |
| LOCATION | 4 | Positioning and navigation.| | LOCATION | 4 | Positioning and navigation. |
| BLUETOOTH_INTERACTION | 5 | Bluetooth-related task.| | BLUETOOTH_INTERACTION | 5 | Bluetooth-related task. |
| MULTI_DEVICE_CONNECTION | 6 | Multi-device connection.| | MULTI_DEVICE_CONNECTION | 6 | Multi-device connection. |
| WIFI_INTERACTION | 7 | WLAN-related (reserved).| | WIFI_INTERACTION | 7 | WLAN-related (reserved). |
| VOIP | 8 | Voice and video call (reserved).| | VOIP | 8 | Voice and video call (reserved). |
| TASK_KEEPING | 9 | Computing task (for PC only).| | TASK_KEEPING | 9 | Computing task. |
...@@ -17,9 +17,9 @@ import sensor from '@system.sensor'; ...@@ -17,9 +17,9 @@ import sensor from '@system.sensor';
## Error Codes ## Error Codes
| Error Code| Description| | Error Code | Description |
| -------- | -------- | | ---------- | ---------------------------------------- |
| 900 | The current device does not support the corresponding sensor.| | 900 | The current device does not support the corresponding sensor. |
## sensor.subscribeAccelerometer ## sensor.subscribeAccelerometer
...@@ -33,19 +33,19 @@ Subscribes to data changes of the acceleration sensor. If this API is called mul ...@@ -33,19 +33,19 @@ Subscribes to data changes of the acceleration sensor. If this API is called mul
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | 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.| | 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.| | success | Function | Yes | Called when the acceleration sensor data changes. |
| fail | Function | No| Callback upon failure.| | fail | Function | No | Callback upon failure. |
Return values of the success callback Return values of the success callback
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | ---- | ------ | --------------------------- |
| x | number | Acceleration on the x-axis.| | x | number | Acceleration on the x-axis. |
| y | number | Acceleration on the y-axis.| | y | number | Acceleration on the y-axis. |
| z | number | Acceleration on the z-axis.| | z | number | Acceleration on the z-axis. |
**Example** **Example**
...@@ -92,16 +92,16 @@ Subscribes to data changes of the compass sensor. If this API is called multiple ...@@ -92,16 +92,16 @@ Subscribes to data changes of the compass sensor. If this API is called multiple
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes| Called when the compass sensor data changes.| | success | Function | Yes | Called when the compass sensor data changes. |
| fail | Function | No| Callback upon failure.| | fail | Function | No | Callback upon failure. |
Return values of the success callback Return values of the success callback
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | --------- | ------ | ------------------------------------ |
| direction | number | Direction of the device, in degrees.| | direction | number | Direction of the device, in degrees. |
**Example** **Example**
...@@ -143,16 +143,16 @@ Subscribes to data changes of the proximity sensor. If this API is called multip ...@@ -143,16 +143,16 @@ Subscribes to data changes of the proximity sensor. If this API is called multip
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes| Called when the proximity sensor data changes.| | success | Function | Yes | Called when the proximity sensor data changes. |
| fail | Function | No| Callback upon failure.| | fail | Function | No | Callback upon failure. |
Return values of the success callback Return values of the success callback
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | -------- | ------ | ---------------------------------------- |
| distance | number | Distance between a visible object and the device screen.| | distance | number | Distance between a visible object and the device screen. |
**Example** **Example**
...@@ -194,16 +194,16 @@ Subscribes to data changes of the ambient light sensor. If this API is called mu ...@@ -194,16 +194,16 @@ Subscribes to data changes of the ambient light sensor. If this API is called mu
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes| Called when the ambient light sensor data changes| | success | Function | Yes | Called when the ambient light sensor data changes |
| fail | Function | No| Callback upon failure.| | fail | Function | No | Callback upon failure. |
Return values of the success callback Return values of the success callback
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | --------- | ------ | ------------------------ |
| intensity | number | Light intensity, in lux.| | intensity | number | Light intensity, in lux. |
**Example** **Example**
...@@ -247,16 +247,16 @@ Subscribes to data changes of the step counter sensor. If this API is called mul ...@@ -247,16 +247,16 @@ Subscribes to data changes of the step counter sensor. If this API is called mul
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes| Called when the step counter sensor data changes.| | success | Function | Yes | Called when the step counter sensor data changes. |
| fail | Function | No| Callback upon failure.| | fail | Function | No | Callback upon failure. |
Return values of the success callback Return values of the success callback
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | ----- | ------ | ---------------------------------------- |
| steps | number | Number of counted steps after the sensor is restarted.<br> | | steps | number | Number of counted steps after the sensor is restarted.<br> |
**Example** **Example**
...@@ -301,16 +301,16 @@ Subscribes to data changes of the barometer sensor. If this API is called multip ...@@ -301,16 +301,16 @@ Subscribes to data changes of the barometer sensor. If this API is called multip
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes| Called when the barometer sensor data changes.| | success | Function | Yes | Called when the barometer sensor data changes. |
| fail | Function | No| Callback upon failure.| | fail | Function | No | Callback upon failure. |
Return values of the success callback Return values of the success callback
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | -------- | ------ | -------------------- |
| pressure | number | Pressure, in pascal.| | pressure | number | Pressure, in pascal. |
**Example** **Example**
...@@ -356,16 +356,16 @@ Subscribes to data changes of the heart rate sensor. If this API is called multi ...@@ -356,16 +356,16 @@ Subscribes to data changes of the heart rate sensor. If this API is called multi
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes| Called when the heart rate sensor data changes. This callback is invoked every five seconds.| | success | Function | Yes | Called when the heart rate sensor data changes. This callback is invoked every five seconds. |
| fail | Function | No| Callback upon failure.| | fail | Function | No | Callback upon failure. |
Return values of the success callback Return values of the success callback
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | --------- | ------ | ----------- |
| heartRate | number | Heart rate.| | heartRate | number | Heart rate. |
**Example** **Example**
...@@ -410,16 +410,16 @@ Subscribes to changes of the wearing state of a wearable device. If this API is ...@@ -410,16 +410,16 @@ Subscribes to changes of the wearing state of a wearable device. If this API is
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ------- | -------- | --------- | -------------------------------------- |
| success | Function | Yes| Called when the wearing state changes.| | success | Function | Yes | Called when the wearing state changes. |
| fail | Function | No| Callback upon failure.| | fail | Function | No | Callback upon failure. |
Return values of the success callback Return values of the success callback
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | ----- | ------- | ------------------------------------ |
| value | boolean | Whether the wearable device is worn.| | value | boolean | Whether the wearable device is worn. |
**Example** **Example**
...@@ -461,17 +461,17 @@ Obtains the wearing state of a wearable device. ...@@ -461,17 +461,17 @@ Obtains the wearing state of a wearable device.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | --------- | -------------------------------------- |
| success | Function | No| Callback upon success.| | success | Function | No | Callback upon success. |
| fail | Function | No| Callback upon failure.| | fail | Function | No | Callback upon failure. |
| complete | Function | No| Called when the execution is complete.| | complete | Function | No | Called when the execution is complete. |
Return values of the success callback Return values of the success callback
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | ----- | ------- | ------------------------------------ |
| value | boolean | Whether the wearable device is worn.| | value | boolean | Whether the wearable device is worn. |
**Example** **Example**
...@@ -498,18 +498,18 @@ If this API is called multiple times for the same application, the last call tak ...@@ -498,18 +498,18 @@ If this API is called multiple times for the same application, the last call tak
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | 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.| | 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.| | success | Function | Yes | Called when the device orientation sensor data changes. |
| fail | Function | No| Callback upon failure.| | fail | Function | No | Callback upon failure. |
Return values of the success callback Return values of the success callback
| Name| Type| Description| | 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.| | 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 phone coincides with the Y/Z 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 phone coincides with the X/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** **Example**
...@@ -558,19 +558,19 @@ If this API is called multiple times for the same application, the last call tak ...@@ -558,19 +558,19 @@ If this API is called multiple times for the same application, the last call tak
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | 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.| | 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.| | success | Function | Yes | Called when the gyroscope sensor data changes. |
| fail | Function | No| Callback upon failure.| | fail | Function | No | Callback upon failure. |
Return values of the success callback Return values of the success callback
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | ---- | ------ | ---------------------------------------- |
| x | number | Rotation angular velocity of the X axis.| | x | number | Rotation angular velocity of the X axis. |
| y | number | Rotation angular velocity of the Y axis.| | y | number | Rotation angular velocity of the Y axis. |
| z | number | Rotation angular velocity of the Z axis.| | z | number | Rotation angular velocity of the Z axis. |
**Example** **Example**
......
...@@ -32,7 +32,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at ...@@ -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 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>
<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> <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> </td>
</tr> </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> <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 ...@@ -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> <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="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> <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"> </span><div class="notebody"><p id="p1744552174711"><a name="p1744552174711"></a><a name="p1744552174711"></a></p>
</div></div> </div></div>
</td> </td>
</tr> </tr>
...@@ -85,7 +85,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at ...@@ -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 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>
<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> <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"> </span><div class="notebody"><p id="p2064014318476"><a name="p2064014318476"></a><a name="p2064014318476"></a></p>
</div></div> </div></div>
</td> </td>
</tr> </tr>
...@@ -98,7 +98,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at ...@@ -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 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>
<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> <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"> </span><div class="notebody"><p id="p12117124720471"><a name="p12117124720471"></a><a name="p12117124720471"></a></p>
</div></div> </div></div>
</td> </td>
</tr> </tr>
......
...@@ -225,8 +225,8 @@ Date selector \(**type** is **date**\) ...@@ -225,8 +225,8 @@ Date selector \(**type** is **date**\)
</td> </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 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>
<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> <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>This attribute is only supported on phones and tablets.</p> <div class="note" id="note1688512355211"><a name="note1688512355211"></a><a name="note1688512355211"></a><span class="notetitle"> </span><div class="notebody"><p id="p488582345212"><a name="p488582345212"></a><a name="p488582345212"></a></p>
</div></div> </div></div>
</td> </td>
</tr> </tr>
...@@ -293,8 +293,8 @@ Date and time selector \(**type** is **datetime**\) ...@@ -293,8 +293,8 @@ Date and time selector \(**type** is **datetime**\)
</td> </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 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>
<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> <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>This attribute is only supported on phones and tablets.</p> <div class="note" id="note11541837195218"><a name="note11541837195218"></a><a name="note11541837195218"></a><span class="notetitle"> </span><div class="notebody"><p id="p454119371529"><a name="p454119371529"></a><a name="p454119371529"></a>
</div></div> </div></div>
</td> </td>
</tr> </tr>
...@@ -424,7 +424,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md) ...@@ -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 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>
<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> <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> </div></div>
</td> </td>
</tr> </tr>
...@@ -437,7 +437,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md) ...@@ -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 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>
<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> <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> </div></div>
</td> </td>
</tr> </tr>
......
...@@ -178,7 +178,7 @@ When **type** is set to **date**, a date selector is used. ...@@ -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 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>
<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> <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> </div></div>
</td> </td>
</tr> </tr>
...@@ -329,7 +329,7 @@ When **type** is set to **datetime**, a date and time selector is used. ...@@ -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 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>
<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> <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> </div></div>
</td> </td>
</tr> </tr>
...@@ -529,7 +529,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md) ...@@ -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 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>
<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> <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"></span><div class="notebody"><p id="p18693101311524"><a name="p18693101311524"></a><a name="p18693101311524"></a></p>
</div></div> </div></div>
</td> </td>
</tr> </tr>
......
...@@ -58,7 +58,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at ...@@ -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 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>
<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> <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"> </span><div class="notebody"><p id="p749462910531"><a name="p749462910531"></a><a name="p749462910531"></a></p>
</div></div> </div></div>
</td> </td>
</tr> </tr>
......
...@@ -76,7 +76,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at ...@@ -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 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>
<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> <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"></span><div class="notebody"><p id="p14509172218549"><a name="p14509172218549"></a><a name="p14509172218549"></a></p>
</div></div> </div></div>
</li></ul> </li></ul>
</td> </td>
...@@ -90,7 +90,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at ...@@ -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 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>
<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> <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"> </span><div class="notebody"><p id="p576523535418"><a name="p576523535418"></a><a name="p576523535418"></a></p>
</div></div> </div></div>
</td> </td>
</tr> </tr>
...@@ -103,7 +103,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at ...@@ -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 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>
<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> <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"></span><div class="notebody"><p id="p4708154510548"><a name="p4708154510548"></a><a name="p4708154510548"></a></p>
</div></div> </div></div>
</td> </td>
</tr> </tr>
...@@ -158,7 +158,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md) ...@@ -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 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>
<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> <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"> </span><div class="notebody"><p id="p7956203555"><a name="p7956203555"></a><a name="p7956203555"></a></p>
</div></div> </div></div>
</td> </td>
</tr> </tr>
......
...@@ -92,7 +92,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at ...@@ -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 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>
<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> <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"> </span><div class="notebody"><p id="p1343012264345"><a name="p1343012264345"></a><a name="p1343012264345"></a></p>
</div></div> </div></div>
</td> </td>
</tr> </tr>
......
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**: > ![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. > - 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. > - ECMAScript 6 (ES6) syntax is not supported in HML.
...@@ -58,7 +58,7 @@ Events can be written in the following formats: ...@@ -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. - 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 - Example
``` ```
<!-- xxx.hml --> <!-- xxx.hml -->
<div class="container"> <div class="container">
...@@ -74,7 +74,7 @@ Events can be written in the following formats: ...@@ -74,7 +74,7 @@ Events can be written in the following formats:
</div> </div>
``` ```
``` ```
// xxx.js // xxx.js
export default { export default {
...@@ -93,7 +93,7 @@ Events can be written in the following formats: ...@@ -93,7 +93,7 @@ Events can be written in the following formats:
}; };
``` ```
``` ```
/* xxx.css */ /* xxx.css */
.container { .container {
...@@ -139,7 +139,7 @@ Bubbling event binding covers the following: ...@@ -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) > For details about bubbling events, see [Universal Events](../reference/arkui-js/js-components-common-events.md)
- Example - Example
``` ```
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
...@@ -157,8 +157,8 @@ Bubbling event binding covers the following: ...@@ -157,8 +157,8 @@ Bubbling event binding covers the following:
<div grab:click="clickfunc"></div> <div grab:click="clickfunc"></div>
</div> </div>
``` ```
``` ```
// xxx.js // xxx.js
export default { export default {
...@@ -185,7 +185,7 @@ Event capturing binding includes: ...@@ -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. - Bind an event callback, but stop the event from being captured during downward transfer: grab:{event}.capture.
- Example - Example
``` ```
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
...@@ -195,7 +195,7 @@ Event capturing binding includes: ...@@ -195,7 +195,7 @@ Event capturing binding includes:
</div> </div>
``` ```
``` ```
// xxx.js // xxx.js
export default { export default {
...@@ -262,9 +262,9 @@ The for loop supports the following statements: ...@@ -262,9 +262,9 @@ The for loop supports the following statements:
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**: > ![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. > - 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 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. > - 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 ...@@ -278,8 +278,8 @@ There are two ways to implement conditional rendering: if-elif-else or show. In
<div class="container"> <div class="container">
<button class="btn" type="capsule" value="toggleShow" onclick="toggleShow"></button> <button class="btn" type="capsule" value="toggleShow" onclick="toggleShow"></button>
<button class="btn" type="capsule" value="toggleDisplay" onclick="toggleDisplay"></button> <button class="btn" type="capsule" value="toggleDisplay" onclick="toggleDisplay"></button>
<text if="{{visible}}"> Hello-TV </text> <text if="{{visible}}"> Hello-World1 </text>
<text elif="{{display}}"> Hello-Wearable </text> <text elif="{{display}}"> Hello-World2 </text>
<text else> Hello-World </text> <text else> Hello-World </text>
</div> </div>
``` ```
......
...@@ -11,7 +11,7 @@ Custom components decorated by @Preview can be previewed in the Previewer of Dev ...@@ -11,7 +11,7 @@ Custom components decorated by @Preview can be previewed in the Previewer of Dev
Example of using @Preview: 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 @Entry
@Component @Component
struct MyComponent { struct MyComponent {
......
...@@ -39,7 +39,7 @@ Create a &lt;list&gt; component in the .hml file under pages/index. ...@@ -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**: > ![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-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. > - &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 ...@@ -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**: > ![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. > - 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. > - You must include "\#" when using a customized indexer.
...@@ -219,7 +219,7 @@ Search for contacts by using an alphabetical indexer. ...@@ -219,7 +219,7 @@ Search for contacts by using an alphabetical indexer.
<div class="container"> <div class="container">
<div class="in-container"> <div class="in-container">
<text class="name">{{$item.name}}</text> <text class="name">{{$item.name}}</text>
<text class="phone">18888888888</text> <text class="number">18888888888</text>
</div> </div>
</div> </div>
</list-item> </list-item>
...@@ -251,7 +251,7 @@ Search for contacts by using an alphabetical indexer. ...@@ -251,7 +251,7 @@ Search for contacts by using an alphabetical indexer.
color: #000000; color: #000000;
font-size: 39px; font-size: 39px;
} }
.phone { .number {
color: black; color: black;
font-size: 25px; font-size: 25px;
} }
......
...@@ -72,9 +72,8 @@ export default { ...@@ -72,9 +72,8 @@ export default {
![en-us_image_0000001267647893](figures/en-us_image_0000001267647893.gif) ![en-us_image_0000001267647893](figures/en-us_image_0000001267647893.gif)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**: > ![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. >
> > 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.
## Setting the Time Format ## Setting the Time Format
...@@ -110,7 +109,7 @@ Set the hours attribute to specify the time format used by the time selector. Av ...@@ -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**: > ![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 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. > - 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, ...@@ -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. 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. The eTS programming language is an extension of the TS language and also supports the TS syntax.
``` ```
enum Category { enum Category {
Fruit, Fruit,
...@@ -22,7 +22,7 @@ On the created page, we use various items to describe food, such as food names, ...@@ -22,7 +22,7 @@ On the created page, we use various items to describe food, such as food names,
Seafood, Seafood,
Dessert Dessert
} }
let NextId = 0; let NextId = 0;
class FoodData { class FoodData {
id: string; id: string;
...@@ -34,7 +34,7 @@ On the created page, we use various items to describe food, such as food names, ...@@ -34,7 +34,7 @@ On the created page, we use various items to describe food, such as food names,
fat: number; fat: number;
carbohydrates: number; carbohydrates: number;
vitaminC: number; vitaminC: number;
constructor(name: string, image: Resource, category: Category, calories: number, protein: number, 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.id = `${ NextId++ }`;
this.name = name; this.name = name;
...@@ -49,13 +49,13 @@ On the created page, we use various items to describe food, such as food names, ...@@ -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. 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. 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. 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 // FoodData.ets
export enum Category { export enum Category {
...@@ -66,7 +66,7 @@ On the created page, we use various items to describe food, such as food names, ...@@ -66,7 +66,7 @@ On the created page, we use various items to describe food, such as food names,
} }
// FoodDataModels.ets // FoodDataModels.ets
import { Category, FoodData } from './FoodData' import { Category, FoodData } from './FoodData'
export function initializeOnStartup(): Array<FoodData> { export function initializeOnStartup(): Array<FoodData> {
let FoodDataArray: Array<FoodData> = [] let FoodDataArray: Array<FoodData> = []
FoodComposition.forEach(item => { FoodComposition.forEach(item => {
......
...@@ -7,8 +7,8 @@ Before creating a project, you need to install DevEco Studio. ...@@ -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. 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) ![en-us_image_0000001267607861](figures/en-us_image_0000001267607861.png)
2. 2.
On the page for selecting an ability template, select [Standard]Empty Ability. 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. ...@@ -20,13 +20,13 @@ Before creating a project, you need to install DevEco Studio.
![en-us_image_0000001223127700](figures/en-us_image_0000001223127700.png) ![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. 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) ![en-us_image_0000001267647849](figures/en-us_image_0000001267647849.png)
5. After the project is created, open the app.ets file. 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. 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 { export default {
onCreate() { onCreate() {
...@@ -39,7 +39,7 @@ Before creating a project, you need to install DevEco Studio. ...@@ -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. 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 @Entry
@Component @Component
...@@ -56,14 +56,14 @@ Before creating a project, you need to install DevEco Studio. ...@@ -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. 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) ![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) ![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) ![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 ...@@ -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) ![en-us_image_0000001267887861](figures/en-us_image_0000001267887861.png)
3. Access images through resources. 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). 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.
![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)
You can then can reference the application resource in the ` "$r('app.type.name')"` format, that is, `$r('app.media.Tomato')`. 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: ...@@ -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. 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'. 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 @Component
struct FoodListItem { struct FoodListItem {
...@@ -50,10 +50,10 @@ The procedure below uses these two mechanisms for redirection between the page l ...@@ -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) ![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. 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' import router from '@system.router'
@Component @Component
struct FoodGridItem { struct FoodGridItem {
private foodItem: FoodData private foodItem: FoodData
...@@ -72,12 +72,12 @@ The procedure below uses these two mechanisms for redirection between the page l ...@@ -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) ![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 // FoodDetail.ets
import router from '@system.router' import router from '@system.router'
@Component @Component
struct PageTitle { struct PageTitle {
build() { build() {
...@@ -100,7 +100,7 @@ The procedure below uses these two mechanisms for redirection between the page l ...@@ -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. 4. Create the Stack component in the FoodDetail component, including the FoodImageDisplay and PageTitle child components. Set the alignment mode to TopStart.
``` ```
@Entry @Entry
@Component @Component
...@@ -126,7 +126,7 @@ The procedure below uses these two mechanisms for redirection between the page l ...@@ -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: 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. 1. Set the params attribute in the Navigator of the FoodListItem component. The params attribute accepts the key-value object.
``` ```
// FoodList.ets // FoodList.ets
@Component @Component
...@@ -143,7 +143,7 @@ We have implemented the redirection and going back of the FoodCategoryList and F ...@@ -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. 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({ router.push({
uri: 'pages/FoodDetail', uri: 'pages/FoodDetail',
...@@ -152,11 +152,11 @@ We have implemented the redirection and going back of the FoodCategoryList and F ...@@ -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. 2. Import the FoodData class to the FoodDetail page and add the foodItem member variable to the FoodDetail component.
``` ```
// FoodDetail.ets // FoodDetail.ets
import { FoodData } from '../model/FoodData' import { FoodData } from '../model/FoodData'
@Entry @Entry
@Component @Component
struct FoodDetail { struct FoodDetail {
...@@ -168,13 +168,13 @@ We have implemented the redirection and going back of the FoodCategoryList and F ...@@ -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. 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 @Entry
@Component @Component
struct FoodDetail { struct FoodDetail {
private foodItem: FoodData = router.getParams().foodData private foodItem: FoodData = router.getParams().foodData
build() { build() {
...... ......
} }
...@@ -182,7 +182,7 @@ We have implemented the redirection and going back of the FoodCategoryList and F ...@@ -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: 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 @Component
struct PageTitle { struct PageTitle {
...@@ -203,7 +203,7 @@ We have implemented the redirection and going back of the FoodCategoryList and F ...@@ -203,7 +203,7 @@ We have implemented the redirection and going back of the FoodCategoryList and F
}) })
} }
} }
@Component @Component
struct FoodImageDisplay { struct FoodImageDisplay {
private foodItem: FoodData private foodItem: FoodData
...@@ -220,11 +220,11 @@ We have implemented the redirection and going back of the FoodCategoryList and F ...@@ -220,11 +220,11 @@ We have implemented the redirection and going back of the FoodCategoryList and F
.backgroundColor('#FFedf2f5') .backgroundColor('#FFedf2f5')
} }
} }
@Component @Component
struct ContentTable { struct ContentTable {
private foodItem: FoodData private foodItem: FoodData
@Builder IngredientItem(title:string, name: string, value: string) { @Builder IngredientItem(title:string, name: string, value: string) {
Flex() { Flex() {
Text(title) Text(title)
...@@ -241,7 +241,7 @@ We have implemented the redirection and going back of the FoodCategoryList and F ...@@ -241,7 +241,7 @@ We have implemented the redirection and going back of the FoodCategoryList and F
.layoutWeight(2) .layoutWeight(2)
} }
} }
build() { build() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Start }) { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Start }) {
this.IngredientItem('Calories', 'Calories', this.foodItem.calories + 'kcal') 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 ...@@ -254,12 +254,12 @@ We have implemented the redirection and going back of the FoodCategoryList and F
.padding({ top: 30, right: 30, left: 30 }) .padding({ top: 30, right: 30, left: 30 })
} }
} }
@Entry @Entry
@Component @Component
struct FoodDetail { struct FoodDetail {
private foodItem: FoodData = router.getParams().foodData private foodItem: FoodData = router.getParams().foodData
build() { build() {
Column() { Column() {
Stack( { alignContent: Alignment.TopStart }) { Stack( { alignContent: Alignment.TopStart }) {
......
此差异已折叠。
...@@ -6,29 +6,29 @@ OpenHarmony系统传感器是应用访问底层硬件传感器的一种设备抽 ...@@ -6,29 +6,29 @@ OpenHarmony系统传感器是应用访问底层硬件传感器的一种设备抽
传感器是指用于侦测环境中所发生事件或变化,并将此消息发送至其他电子设备(如中央处理器)的设备,通常由敏感组件和转换组件组成。传感器是实现物联网智能化的重要基石,为实现全场景智慧化战略,支撑“1+8+N”产品需求,需要构筑统一的传感器管理框架,达到为各产品/业务提供低时延、低功耗的感知数据的目的。下面为传感器列表: 传感器是指用于侦测环境中所发生事件或变化,并将此消息发送至其他电子设备(如中央处理器)的设备,通常由敏感组件和转换组件组成。传感器是实现物联网智能化的重要基石,为实现全场景智慧化战略,支撑“1+8+N”产品需求,需要构筑统一的传感器管理框架,达到为各产品/业务提供低时延、低功耗的感知数据的目的。下面为传感器列表:
| 传感器类型 | 描述 | 说明 | 主要用途 | | 传感器类型 | 描述 | 说明 | 主要用途 |
| --------------------------------------- | ------------------ | ------------------------------------------------------------ | ---------------------------------------- | | --------------------------------------- | --------- | ---------------------------------------- | -------------------- |
| SENSOR_TYPE_ACCELEROMETER | 加速度传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,施加在设备上的加速度(包括重力加速度),单位&nbsp;:&nbsp;m/s2 | 检测运动状态 | | 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_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_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_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 | 陀螺仪传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,设备的旋转角速度,单位&nbsp;:&nbsp;rad/s | 测量旋转的角速度 |
| SENSOR_TYPE_GYROSCOPE_UNCALIBRATED | 未校准陀螺仪传感器 | 测量三个物理轴(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_SIGNIFICANT_MOTION | 大幅度动作传感器 | 测量三个物理轴(x、y&nbsp;&nbsp;z)上,设备是否存在大幅度运动;如果取值为1则代表存在大幅度运动,取值为0则代表没有大幅度运动 | 用于检测设备是否存在大幅度运动 |
| SENSOR_TYPE_PEDOMETER_DETECTION | 计步器检测传感器 | 检测用户的计步动作;如果取值为1则代表用户产生了计步行走的动作;取值为0则代表用户没有发生运动 | 用于检测用户是否有计步的动作 | | SENSOR_TYPE_PEDOMETER_DETECTION | 计步器检测传感器 | 检测用户的计步动作;如果取值为1则代表用户产生了计步行走的动作;取值为0则代表用户没有发生运动 | 用于检测用户是否有计步的动作 |
| SENSOR_TYPE_PEDOMETER | 计步器传感器 | 统计用户的行走步数 | 用于提供用户行走的步数数据 | | SENSOR_TYPE_PEDOMETER | 计步器传感器 | 统计用户的行走步数 | 用于提供用户行走的步数数据 |
| SENSOR_TYPE_AMBIENT_TEMPERATURE | 环境温度传感器 | 测量环境温度,单位&nbsp;:&nbsp;摄氏度&nbsp;(°C) | 测量环境温度 | | SENSOR_TYPE_AMBIENT_TEMPERATURE | 环境温度传感器 | 测量环境温度,单位&nbsp;:&nbsp;摄氏度&nbsp;(°C) | 测量环境温度 |
| SENSOR_TYPE_MAGNETIC_FIELD | 磁场传感器 | 测量三个物理轴向(x、y、z)上,环境地磁场,单位&nbsp;:&nbsp;μT | 创建指南针 | | SENSOR_TYPE_MAGNETIC_FIELD | 磁场传感器 | 测量三个物理轴向(x、y、z)上,环境地磁场,单位&nbsp;:&nbsp;μT | 创建指南针 |
| SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | 未校准磁场传感器 | 测量三个物理轴向(x、y、z)上,未校准环境地磁场,单位&nbsp;:&nbsp;μT | 测量地磁偏差估值 | | SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | 未校准磁场传感器 | 测量三个物理轴向(x、y、z)上,未校准环境地磁场,单位&nbsp;:&nbsp;μT | 测量地磁偏差估值 |
| SENSOR_TYPE_HUMIDITY | 湿度传感器 | 测量环境的相对湿度,以百分比&nbsp;(%)&nbsp;表示 | 监测露点、绝对湿度和相对湿度 | | SENSOR_TYPE_HUMIDITY | 湿度传感器 | 测量环境的相对湿度,以百分比&nbsp;(%)&nbsp;表示 | 监测露点、绝对湿度和相对湿度 |
| SENSOR_TYPE_BAROMETER | 气压计传感器 | 测量环境气压,单位&nbsp;:&nbsp;hPa&nbsp;&nbsp;mbar | 测量环境气压 | | SENSOR_TYPE_BAROMETER | 气压计传感器 | 测量环境气压,单位&nbsp;:&nbsp;hPa&nbsp;&nbsp;mbar | 测量环境气压 |
| SENSOR_TYPE_ORIENTATION | 方向传感器 | 测量设备围绕所有三个物理轴(x、y、z)旋转的角度值,单位:rad | 用于提供屏幕旋转的3个角度值 | | SENSOR_TYPE_ORIENTATION | 方向传感器 | 测量设备围绕所有三个物理轴(x、y、z)旋转的角度值,单位:rad | 用于提供屏幕旋转的3个角度值 |
| SENSOR_TYPE_ROTATION_VECTOR | 旋转矢量传感器 | 测量设备旋转矢量,复合传感器:由加速度传感器、磁场传感器、陀螺仪传感器合成 | 检测设备相对于东北天坐标系的方向 | | SENSOR_TYPE_ROTATION_VECTOR | 旋转矢量传感器 | 测量设备旋转矢量,复合传感器:由加速度传感器、磁场传感器、陀螺仪传感器合成 | 检测设备相对于东北天坐标系的方向 |
| SENSOR_TYPE_PROXIMITY | 接近光传感器 | 测量可见物体相对于设备显示屏的接近或远离状态 | 通话中设备相对人的位置 | | SENSOR_TYPE_PROXIMITY | 接近光传感器 | 测量可见物体相对于设备显示屏的接近或远离状态 | 通话中设备相对人的位置 |
| SENSOR_TYPE_AMBIENT_LIGHT | 环境光传感器 | 测量设备周围光线强度,单位:lux | 自动调节屏幕亮度,检测屏幕上方是否有遮挡 | | SENSOR_TYPE_AMBIENT_LIGHT | 环境光传感器 | 测量设备周围光线强度,单位:lux | 自动调节屏幕亮度,检测屏幕上方是否有遮挡 |
| SENSOR_TYPE_HEART_RATE | 心率传感器 | 测量用户的心率数值 | 用于提供用户的心率健康数据 | | SENSOR_TYPE_HEART_RATE | 心率传感器 | 测量用户的心率数值 | 用于提供用户的心率健康数据 |
| SENSOR_TYPE_WEAR_DETECTION | 佩戴检测传感器 | 检测用户是否佩戴 | 用于检测用户是否佩戴智能穿戴 | | SENSOR_TYPE_WEAR_DETECTION | 佩戴检测传感器 | 检测用户是否佩戴 | 用于检测用户是否佩戴智能穿戴 |
| SENSOR_TYPE_HALL | 霍尔传感器 | 测量设备周围是否存在磁力吸引 | 设备的皮套模式 | | SENSOR_TYPE_HALL | 霍尔传感器 | 测量设备周围是否存在磁力吸引 | 设备的皮套模式 |
## 运作机制 ## 运作机制
...@@ -54,12 +54,12 @@ OpenHarmony传感器包含如下四个模块:Sensor API、Sensor Framework、S ...@@ -54,12 +54,12 @@ OpenHarmony传感器包含如下四个模块:Sensor API、Sensor Framework、S
表7 传感器数据权限 表7 传感器数据权限
| 传感器 | 权限名 | 敏感级别 | 权限描述 | | 传感器 | 权限名 | 敏感级别 | 权限描述 |
| ------------------------- | -------------------------------- | ------------ | ----------------------- | | ------------------------- | -------------------------------- | ------------ | ----------------------- |
| 加速度传感器,加速度未校准传感器,线性加速度传感器 | ohos.permission.ACCELEROMETER | system_grant | 允许订阅Motion组对应的加速度传感器的数据 | | 加速度传感器,加速度未校准传感器,线性加速度传感器 | ohos.permission.ACCELEROMETER | system_grant | 允许订阅Motion组对应的加速度传感器的数据 |
| 陀螺仪传感器,陀螺仪未校准传感器 | ohos.permission.GYROSCOPE | system_grant | 允许订阅Motion组对应的陀螺仪传感器的数据 | | 陀螺仪传感器,陀螺仪未校准传感器 | ohos.permission.GYROSCOPE | system_grant | 允许订阅Motion组对应的陀螺仪传感器的数据 |
| 计步器 | ohos.permission.ACTIVITY_MOTION | user_grant | 允许订阅运动状态 | | 计步器 | ohos.permission.ACTIVITY_MOTION | user_grant | 允许订阅运动状态 |
| 心率计 | ohos.permission.READ_HEALTH_DATA | user_grant | 允许读取健康数据 | | 心率计 | ohos.permission.READ_HEALTH_DATA | user_grant | 允许读取健康数据 |
......
...@@ -22,15 +22,15 @@ requestSuspendDelay(reason: string, callback: Callback&lt;void&gt;): DelaySuspen ...@@ -22,15 +22,15 @@ requestSuspendDelay(reason: string, callback: Callback&lt;void&gt;): DelaySuspen
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask **系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------------------- | ---- | ------------------------------ |
| reason | string | 是 | 延迟挂起申请的原因。 | | reason | string | 是 | 延迟挂起申请的原因。 |
| callback | Callback&lt;void&gt; | 是 | 延迟即将超时的回调函数,一般在超时前6秒通过此回调通知应用。 | | callback | Callback&lt;void&gt; | 是 | 延迟即将超时的回调函数,一般在超时前6秒通过此回调通知应用。 |
**返回值** **返回值**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | ------------------------------------- | --------- |
| [DelaySuspendInfo](#delaysuspendinfo) | 返回延迟挂起信息。 | | [DelaySuspendInfo](#delaysuspendinfo) | 返回延迟挂起信息。 |
**示例** **示例**
```js ```js
...@@ -50,10 +50,10 @@ getRemainingDelayTime(requestId: number, callback: AsyncCallback&lt;number&gt;): ...@@ -50,10 +50,10 @@ getRemainingDelayTime(requestId: number, callback: AsyncCallback&lt;number&gt;):
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask **系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | --------- | --------------------------- | ---- | ---------------------------------------- |
| requestId | number | 是 | 延迟挂起的请求ID。 | | requestId | number | 是 | 延迟挂起的请求ID。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 指定的callback回调方法。用于返回应用程序进入挂起状态之前的剩余时间,以毫秒为单位。 | | callback | AsyncCallback&lt;number&gt; | 是 | 指定的callback回调方法。用于返回应用程序进入挂起状态之前的剩余时间,以毫秒为单位。 |
**示例** **示例**
...@@ -78,14 +78,14 @@ getRemainingDelayTime(requestId: number): Promise&lt;number&gt; ...@@ -78,14 +78,14 @@ getRemainingDelayTime(requestId: number): Promise&lt;number&gt;
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask **系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | --------- | ------ | ---- | ---------- |
| requestId | number | 是 | 延迟挂起的请求ID。 | | requestId | number | 是 | 延迟挂起的请求ID。 |
**返回值** **返回值**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | --------------------- | ---------------------------------------- |
| Promise&lt;number&gt; | 指定的Promise回调方法。返回应用程序进入挂起状态之前的剩余时间,以毫秒为单位。 | | Promise&lt;number&gt; | 指定的Promise回调方法。返回应用程序进入挂起状态之前的剩余时间,以毫秒为单位。 |
**示例** **示例**
```js ```js
...@@ -107,9 +107,9 @@ cancelSuspendDelay(requestId: number): void ...@@ -107,9 +107,9 @@ cancelSuspendDelay(requestId: number): void
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask **系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | --------- | ------ | ---- | ---------- |
| requestId | number | 是 | 延迟挂起的请求ID。 | | requestId | number | 是 | 延迟挂起的请求ID。 |
**示例** **示例**
```js ```js
...@@ -128,12 +128,12 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want ...@@ -128,12 +128,12 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask **系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | --------- | ---------------------------------- | ---- | ------------------------ |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 | | context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。| | bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 |
| wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 | | wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动长时任务的结果。 | | callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动长时任务的结果。 |
**示例** **示例**
```js ```js
...@@ -180,16 +180,16 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want ...@@ -180,16 +180,16 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | --------- | ---------------------------------- | ---- | ----------------------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 | | context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 | | bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 |
| wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 | | wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 |
**返回值** **返回值**
| 类型 | 说明 | | 类型 | 说明 |
| -------------- | ------------------------- | | -------------- | ---------------- |
| Promise\<void> | 使用Promise形式返回结果。 | | Promise\<void> | 使用Promise形式返回结果。 |
**示例** **示例**
```js ```js
...@@ -229,10 +229,10 @@ stopBackgroundRunning(context: Context, callback: AsyncCallback&lt;void&gt;): vo ...@@ -229,10 +229,10 @@ stopBackgroundRunning(context: Context, callback: AsyncCallback&lt;void&gt;): vo
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask **系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | ----------------------------- | ---- | ---------------------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 | | context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动长时任务的结果。 | | callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动长时任务的结果。 |
**示例** **示例**
```js ```js
...@@ -260,14 +260,14 @@ stopBackgroundRunning(context: Context): Promise&lt;void&gt; ...@@ -260,14 +260,14 @@ stopBackgroundRunning(context: Context): Promise&lt;void&gt;
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask **系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | ----------------------------- | ---- | --------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 | | context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
**返回值** **返回值**
| 类型 | 说明 | | 类型 | 说明 |
| -------------- | ------------------------- | | -------------- | ---------------- |
| Promise\<void> | 使用Promise形式返回结果。 | | Promise\<void> | 使用Promise形式返回结果。 |
**示例** **示例**
```js ```js
...@@ -288,24 +288,24 @@ backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then(() ...@@ -288,24 +288,24 @@ backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then(()
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask **系统能力:** 以下各项对应的系统能力均为SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | --------------- | ------ | ---- | ---------------------------------------- |
| requestId | number | 是 | 延迟挂起的请求ID。 | | requestId | number | 是 | 延迟挂起的请求ID。 |
| actualDelayTime | number | 是 | 应用的实际挂起延迟时间,以毫秒为单位。<br/>一般情况下默认值为180000,低电量(依据系统低电量广播)时默认值为60000。 | | actualDelayTime | number | 是 | 应用的实际挂起延迟时间,以毫秒为单位。<br/>一般情况下默认值为180000,低电量(依据系统低电量广播)时默认值为60000。 |
## BackgroundMode<sup>8+</sup> ## BackgroundMode<sup>8+</sup>
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask **系统能力:** 以下各项对应的系统能力均为SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
| 参数名 | 参数值 | 描述 | | 参数名 | 参数值 | 描述 |
| ----------------------- | -------- | -------- | | ----------------------- | ---- | ------------ |
| DATA_TRANSFER | 1 | 数据传输 | | DATA_TRANSFER | 1 | 数据传输 |
| AUDIO_PLAYBACK | 2 | 音频播放 | | AUDIO_PLAYBACK | 2 | 音频播放 |
| AUDIO_RECORDING | 3 | 录音 | | AUDIO_RECORDING | 3 | 录音 |
| LOCATION | 4 | 定位导航 | | LOCATION | 4 | 定位导航 |
| BLUETOOTH_INTERACTION | 5 | 蓝牙相关 | | BLUETOOTH_INTERACTION | 5 | 蓝牙相关 |
| MULTI_DEVICE_CONNECTION | 6 | 多设备互联 | | MULTI_DEVICE_CONNECTION | 6 | 多设备互联 |
| WIFI_INTERACTION | 7 | WLAN相关(系统保留) | | WIFI_INTERACTION | 7 | WLAN相关(系统保留) |
| VOIP | 8 | 音视频通话(系统保留) | | VOIP | 8 | 音视频通话(系统保留) |
| TASK_KEEPING | 9 | 计算任务(仅供PC使用) | | TASK_KEEPING | 9 | 计算任务 |
\ No newline at end of file \ No newline at end of file
...@@ -21,9 +21,9 @@ showToast(options: ShowToastOptions): void ...@@ -21,9 +21,9 @@ showToast(options: ShowToastOptions): void
**系统能力:** SystemCapability.ArkUI.ArkUI.Full **系统能力:** SystemCapability.ArkUI.ArkUI.Full
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | ------------------------------------- | ---- | ------- |
| options | [ShowToastOptions](#showtoastoptions) | 是 | 文本弹窗选项。 | | options | [ShowToastOptions](#showtoastoptions) | 是 | 文本弹窗选项。 |
**示例:** **示例:**
``` ```
...@@ -42,11 +42,11 @@ showToast(options: ShowToastOptions): void ...@@ -42,11 +42,11 @@ showToast(options: ShowToastOptions): void
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------------- | ---- | ---------------------------------------- |
| message | string | 是 | 显示的文本信息。 | | message | string | 是 | 显示的文本信息。 |
| duration | number | 否 | 默认值1500ms,建议区间:1500ms-10000ms,若小于1500ms则取默认值。 | | duration | number | 否 | 默认值1500ms,建议区间:1500ms-10000ms,若小于1500ms则取默认值。 |
| bottom | &lt;length&gt; | 否 | 设置弹窗边框距离屏幕底部的位置,仅手机和平板设备支持。 | | bottom | &lt;length&gt; | 否 | 设置弹窗边框距离屏幕底部的位置。 |
## prompt.showDialog ## prompt.showDialog
...@@ -57,15 +57,15 @@ showDialog(options: ShowDialogOptions): Promise&lt;ShowDialogSuccessResponse&gt; ...@@ -57,15 +57,15 @@ showDialog(options: ShowDialogOptions): Promise&lt;ShowDialogSuccessResponse&gt;
**系统能力:** SystemCapability.ArkUI.ArkUI.Full **系统能力:** 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 ...@@ -106,10 +106,10 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback&lt;ShowDialogSucc
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | ------------ |
| options | [ShowDialogOptions](#showdialogoptions) | 是 | 页面显示对话框信息描述。| | options | [ShowDialogOptions](#showdialogoptions) | 是 | 页面显示对话框信息描述。 |
| callback | AsyncCallback&lt;[ShowDialogSuccessResponse](#showdialogsuccessresponse)&gt; | 是 | 对话框响应结果回调。 | | callback | AsyncCallback&lt;[ShowDialogSuccessResponse](#showdialogsuccessresponse)&gt; | 是 | 对话框响应结果回调。 |
**示例:** **示例:**
``` ```
...@@ -146,11 +146,11 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback&lt;ShowDialogSucc ...@@ -146,11 +146,11 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback&lt;ShowDialogSucc
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | ------ | ---- | ---------------------------------------- |
| title | string | 否 | 标题文本。 | | title | string | 否 | 标题文本。 |
| message | string | 否 | 内容文本。 | | message | string | 否 | 内容文本。 |
| buttons | Array | 否 | 对话框中按钮的数组,结构为:{text:'button',&nbsp;color:&nbsp;'\#666666'},支持1-3个按钮。其中第一个为positiveButton;第二个为negativeButton;第三个为neutralButton。 | | buttons | Array | 否 | 对话框中按钮的数组,结构为:{text:'button',&nbsp;color:&nbsp;'\#666666'},支持1-3个按钮。其中第一个为positiveButton;第二个为negativeButton;第三个为neutralButton。 |
## ShowDialogSuccessResponse ## ShowDialogSuccessResponse
...@@ -158,8 +158,8 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback&lt;ShowDialogSucc ...@@ -158,8 +158,8 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback&lt;ShowDialogSucc
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 说明 | | 名称 | 类型 | 说明 |
| -------- | -------- | -------- | | ----- | ------ | ------------------- |
| index | number | 选中按钮在buttons数组中的索引。 | | index | number | 选中按钮在buttons数组中的索引。 |
...@@ -172,10 +172,10 @@ showActionMenu(options: ActionMenuOptions, callback: AsyncCallback&lt;ActionMenu ...@@ -172,10 +172,10 @@ showActionMenu(options: ActionMenuOptions, callback: AsyncCallback&lt;ActionMenu
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | --------- |
| options | [ActionMenuOptions](#actionmenuoptions) | 是 | 操作菜单选项。 | | options | [ActionMenuOptions](#actionmenuoptions) | 是 | 操作菜单选项。 |
| callback | AsyncCallback&lt;[ActionMenuSuccessResponse](#actionmenusuccessresponse)> | 是 | 菜单响应结果回调。 | | callback | AsyncCallback&lt;[ActionMenuSuccessResponse](#actionmenusuccessresponse)> | 是 | 菜单响应结果回调。 |
**示例:** **示例:**
...@@ -215,14 +215,14 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse> ...@@ -215,14 +215,14 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>
**系统能力:** SystemCapability.ArkUI.ArkUI.Full **系统能力:** 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> ...@@ -256,10 +256,10 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | ------ | ---- | ---------------------------------------- |
| title | string | 否 | 标题文本。 | | title | string | 否 | 标题文本。 |
| buttons | Array | 是 | 菜单中菜单项按钮的数组,结构为:{text:'button',&nbsp;color:&nbsp;'\#666666'},支持1-6个按钮。大于6个按钮时弹窗不显示。 | | buttons | Array | 是 | 菜单中菜单项按钮的数组,结构为:{text:'button',&nbsp;color:&nbsp;'\#666666'},支持1-6个按钮。大于6个按钮时弹窗不显示。 |
## ActionMenuSuccessResponse ## ActionMenuSuccessResponse
...@@ -267,7 +267,7 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse> ...@@ -267,7 +267,7 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full。
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ----- | ------ | ---- | ------------------------ |
| index | number | 否 | 选中按钮在buttons数组中的索引,从0开始。 | | index | number | 否 | 选中按钮在buttons数组中的索引,从0开始。 |
...@@ -135,7 +135,7 @@ export default { ...@@ -135,7 +135,7 @@ export default {
| ------------------- | -------------- | ---- | ---------------------------------------- | | ------------------- | -------------- | ---- | ---------------------------------------- |
| message | string | 是 | 显示的文本信息。 | | message | string | 是 | 显示的文本信息。 |
| duration | number | 否 | 默认值1500ms,建议区间:1500ms-10000ms。若小于1500ms则取默认值,最大取值为10000ms。 | | duration | number | 否 | 默认值1500ms,建议区间:1500ms-10000ms。若小于1500ms则取默认值,最大取值为10000ms。 |
| bottom<sup>5+</sup> | string\|number | 否 | 设置弹窗边框距离屏幕底部的位置,仅手机和平板设备支持。 | | bottom<sup>5+</sup> | string\|number | 否 | 设置弹窗边框距离屏幕底部的位置 |
## Button ## Button
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 本模块首批接口从API version 4开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 >
> - 从API Version 8开始,该接口不再维护,推荐使用新接口[`@ohos.sensor`](js-apis-sensor.md)。 > - 从API Version 8开始,该接口不再维护,推荐使用新接口[`@ohos.sensor`](js-apis-sensor.md)。
> - 本模块首批接口从API version 4开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> - 该功能使用需要对应硬件支持,仅支持真机调试。 > - 该功能使用需要对应硬件支持,仅支持真机调试。
...@@ -17,9 +18,9 @@ import sensor from '@system.sensor'; ...@@ -17,9 +18,9 @@ import sensor from '@system.sensor';
## 传感器错误码列表 ## 传感器错误码列表
| 错误码 | 说明 | | 错误码 | 说明 |
| -------- | -------- | | ---- | -------------- |
| 900 | 当前设备不支持相应的传感器。 | | 900 | 当前设备不支持相应的传感器。 |
## sensor.subscribeAccelerometer ## sensor.subscribeAccelerometer
...@@ -33,19 +34,19 @@ subscribeAccelerometer(Object): void ...@@ -33,19 +34,19 @@ subscribeAccelerometer(Object): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | ---- | ---------------------------------------- |
| interval | string | 是 | 频率参数,加速度的回调函数执行频率。<br/>默认为normal,可选值有:<br/>-&nbsp;game:极高的回调频率,20ms/次,适用于游戏。<br/>-&nbsp;ui:较高的回调频率,60ms/次,适用于UI更新。<br/>-&nbsp;normal:普通的回调频率,200ms/次,低功耗。 | | interval | string | 是 | 频率参数,加速度的回调函数执行频率。<br/>默认为normal,可选值有:<br/>-&nbsp;game:极高的回调频率,20ms/次,适用于游戏。<br/>-&nbsp;ui:较高的回调频率,60ms/次,适用于UI更新。<br/>-&nbsp;normal:普通的回调频率,200ms/次,低功耗。 |
| success | Function | 是 | 感应到加速度数据变化后的回调函数。 | | success | Function | 是 | 感应到加速度数据变化后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值: success返回值:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | ---- | ------ | ------- |
| x | number | x轴的加速度。 | | x | number | x轴的加速度。 |
| y | number | y轴的加速度。 | | y | number | y轴的加速度。 |
| z | number | z轴的加速度。 | | z | number | z轴的加速度。 |
**示例:** **示例:**
...@@ -92,16 +93,16 @@ subscribeCompass(Object): void ...@@ -92,16 +93,16 @@ subscribeCompass(Object): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | -------- | ---- | --------------- |
| success | Function | 是 | 罗盘数据改变后触发的回调函数。 | | success | Function | 是 | 罗盘数据改变后触发的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值: success返回值:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | --------- | ------ | ---------- |
| direction | number | 设备面对的方向度数。 | | direction | number | 设备面对的方向度数。 |
**示例:** **示例:**
...@@ -143,16 +144,16 @@ subscribeProximity(Object): void ...@@ -143,16 +144,16 @@ subscribeProximity(Object): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | -------- | ---- | ----------------- |
| success | Function | 是 | 距离感应数据改变后调用的回调函数。 | | success | Function | 是 | 距离感应数据改变后调用的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值: success返回值:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | -------- | ------ | --------------------- |
| distance | number | 可见物体相对于设备显示屏的接近或远离状态。 | | distance | number | 可见物体相对于设备显示屏的接近或远离状态。 |
**示例:** **示例:**
...@@ -194,16 +195,16 @@ sensor.subscribeLight(Object): void ...@@ -194,16 +195,16 @@ sensor.subscribeLight(Object): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | -------- | ---- | --------------- |
| success | Function | 是 | 光线感应数据改变后的回调函数。 | | success | Function | 是 | 光线感应数据改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值: success返回值:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | --------- | ------ | ------------ |
| intensity | number | 光线强度,单位为lux。 | | intensity | number | 光线强度,单位为lux。 |
**示例:** **示例:**
...@@ -247,16 +248,16 @@ subscribeStepCounter(Object): void ...@@ -247,16 +248,16 @@ subscribeStepCounter(Object): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | -------- | ---- | ---------------- |
| success | Function | 是 | 计步传感器数据改变后的回调函数。 | | success | Function | 是 | 计步传感器数据改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值: success返回值:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | ----- | ------ | --------------------- |
| steps | number | 计步传感器重启后累计记录的步数。<br/> | | steps | number | 计步传感器重启后累计记录的步数。<br/> |
**示例:** **示例:**
...@@ -301,16 +302,16 @@ subcribeBarometer(Object): void ...@@ -301,16 +302,16 @@ subcribeBarometer(Object): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | -------- | ---- | ---------------- |
| success | Function | 是 | 气压传感器数据改变后的回调函数。 | | success | Function | 是 | 气压传感器数据改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值: success返回值:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | -------- | ------ | ----------- |
| pressure | number | 气压值,单位:帕斯卡。 | | pressure | number | 气压值,单位:帕斯卡。 |
**示例:** **示例:**
...@@ -356,16 +357,16 @@ subscribeHeartRate(Object): void ...@@ -356,16 +357,16 @@ subscribeHeartRate(Object): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | -------- | ---- | ------------------------- |
| success | Function | 是 | 心率传感器数据改变后的回调函数,默认频率5s/次。 | | success | Function | 是 | 心率传感器数据改变后的回调函数,默认频率5s/次。 |
| fail | Function | 否 | 接口调用失败的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值: success返回值:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | --------- | ------ | ---- |
| heartRate | number | 心率值。 | | heartRate | number | 心率值。 |
**示例:** **示例:**
...@@ -410,16 +411,16 @@ subscribeOnBodyState(Object): void ...@@ -410,16 +411,16 @@ subscribeOnBodyState(Object): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | -------- | ---- | ------------- |
| success | Function | 是 | 穿戴状态改变后的回调函数。 | | success | Function | 是 | 穿戴状态改变后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值: success返回值:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | ----- | ------- | ------ |
| value | boolean | 是否已佩戴。 | | value | boolean | 是否已佩戴。 |
**示例:** **示例:**
...@@ -461,17 +462,17 @@ getOnBodyState(Object): void ...@@ -461,17 +462,17 @@ getOnBodyState(Object): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | ---- | ------------ |
| success | Function | 否 | 接口调用成功的回调函数。 | | success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 | | complete | Function | 否 | 接口调用结束的回调函数。 |
success返回值: success返回值:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | ----- | ------- | ------ |
| value | boolean | 是否已佩戴。 | | value | boolean | 是否已佩戴。 |
**示例:** **示例:**
...@@ -498,18 +499,18 @@ subscribeDeviceOrientation(interval: string, success: (data: DeviceOrientationRe ...@@ -498,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/次,低功耗。 | | interval | string | 是 | 频率参数,设备方向传感器的回调函数执行频率。<br/>默认为normal,可选值有:<br/>-&nbsp;game:极高的回调频率,20ms/次,适用于游戏。<br/>-&nbsp;ui:较高的回调频率,60ms/次,适用于UI更新。<br/>-&nbsp;normal:普通的回调频率,200ms/次,低功耗。 |
| success | Function | 是 | 感应到设备方向传感器数据变化后的回调函数。 | | success | Function | 是 | 感应到设备方向传感器数据变化后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值: success返回值:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | ----- | ------ | ---------------------------------------- |
| alpha | number | 当手机坐标&nbsp;X/Y&nbsp;和地球&nbsp;X/Y&nbsp;重合时,绕着&nbsp;Z&nbsp;轴转动的夹角为&nbsp;alpha。 | | 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。 | | 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。 | | gamma | number | 当设备&nbsp;X/Z&nbsp;和地球&nbsp;X/Z&nbsp;重合时,绕着&nbsp;Y&nbsp;轴转动的夹角为&nbsp;gamma。 |
**示例:** **示例:**
...@@ -558,19 +559,19 @@ subscribeGyroscope(interval: string, success: (data: GyroscopeResponse), fail?: ...@@ -558,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/次,低功耗。 | | interval | string | 是 | 频率参数,陀螺仪的回调函数执行频率。<br/>默认为normal,可选值有:<br/>-&nbsp;game:极高的回调频率,20ms/次,适用于游戏。<br/>-&nbsp;ui:较高的回调频率,60ms/次,适用于UI更新。<br/>-&nbsp;normal:普通的回调频率,200ms/次,低功耗。 |
| success | Function | 是 | 感应到陀螺仪数据变化后的回调函数。 | | success | Function | 是 | 感应到陀螺仪数据变化后的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值: success返回值:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | ---- | ------ | --------- |
| x | number | x轴的旋转角速度。 | | x | number | x轴的旋转角速度。 |
| y | number | y轴的旋转角速度。 | | y | number | y轴的旋转角速度。 |
| z | number | z轴的旋转角速度。 | | z | number | z轴的旋转角速度。 |
**示例:** **示例:**
......
# 升级 升级
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
升级依赖:升级分为SD卡升级和在线升级两种。 升级依赖:升级分为SD卡升级和在线升级两种。
- SD卡升级依赖升级包和SD卡安装。 - SD卡升级依赖升级包和SD卡安装。
- 在线升级依赖手机厂商部署的用于管理升级包的服务器。服务器由手机厂商部署,IP由调用者传入,请求的request接口是固定的,由手机厂商开发。 - 在线升级依赖设备厂商部署的用于管理升级包的服务器。服务器由设备厂商部署,IP由调用者传入,请求的request接口是固定的,由设备厂商开发。
## 导入模块 ## 导入模块
......
...@@ -15,68 +15,68 @@ ...@@ -15,68 +15,68 @@
除支持[通用属性](../arkui-js/js-components-common-attributes.md)外,还支持如下属性: 除支持[通用属性](../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 文本选择器: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"]。 | | 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的索引。 | | selected | string | 0 | 否 | 设置文本选择器的默认选择值,该值需要为range的索引。 |
| indicatorprefix | string | - | 否 | 文本选择器选定值增加的前缀字段。 | | indicatorprefix | string | - | 否 | 文本选择器选定值增加的前缀字段。 |
| indicatorsuffix | string | - | 否 | 文本选择器选定值增加的后缀字段。 | | indicatorsuffix | string | - | 否 | 文本选择器选定值增加的后缀字段。 |
时间选择器:type=time 时间选择器:type=time
| 名称 | 类型 | 默认值 | 必填 | 描述 | | 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- | | ------------- | ------- | ----------------------------------- | ---- | ---------------------------------------- |
| containsecond | boolean | false | 否 | 时间选择器是否包含秒。 | | containsecond | boolean | false | 否 | 时间选择器是否包含秒。 |
| selected | string | 当前时间 | 否 | 设置时间选择器的默认取值,格式为&nbsp;HH:mm;<br/>当包含秒时,格式为HH:mm:ss。 | | 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> | | 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 日期选择器:type=date
| 名称 | 类型 | 默认值 | 必填 | 描述 | | 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- | | ------------------ | ------------ | ---------- | ---- | ---------------------------------------- |
| start | &lt;time&gt; | 1970-1-1 | 否 | 设置日期选择器的起始时间,格式为&nbsp;YYYY-MM-DD。 | | start | &lt;time&gt; | 1970-1-1 | 否 | 设置日期选择器的起始时间,格式为&nbsp;YYYY-MM-DD。 |
| end | &lt;time&gt; | 2100-12-31 | 否 | 设置日期选择器的结束时间,格式为&nbsp;YYYY-MM-DD。 | | end | &lt;time&gt; | 2100-12-31 | 否 | 设置日期选择器的结束时间,格式为&nbsp;YYYY-MM-DD。 |
| selected | string | 当前日期 | 否 | 设置日期选择器的默认选择值,格式为&nbsp;YYYY-MM-DD。 | | selected | string | 当前日期 | 否 | 设置日期选择器的默认选择值,格式为&nbsp;YYYY-MM-DD。 |
| lunar<sup>5+</sup> | boolean | false | 否 | 设置日期选择器弹窗界面是否为农历展示。 | | lunar<sup>5+</sup> | boolean | false | 否 | 设置日期选择器弹窗界面是否为农历展示。 |
| lunarswitch | boolean | false | 否 | 设置日期选择器是否显示农历开关,显示农历开关时,可以在弹窗界面展现农历的开关由于公历和农历切换。在设置显示农历时,开关状态为开,当设置不显示农历时,开关状态为关。手机生效。 | | lunarswitch | boolean | false | 否 | 设置日期选择器是否显示农历开关,显示农历开关时,可以在弹窗界面展现农历的开关由于公历和农历切换。在设置显示农历时,开关状态为开,当设置不显示农历时,开关状态为关。 |
日期时间选择器:type=datetime,日期的选择范围为本年的日月。 日期时间选择器:type=datetime,日期的选择范围为本年的日月。
| 名称 | 类型 | 默认值 | 必填 | 描述 | | 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- | | ------------------ | ------- | ----------------------------------- | ---- | ---------------------------------------- |
| selected | string | 当前日期时间 | 否 | 设置日期时间选择器的默认取值,格式有两种,为月日时分MM-DD-HH-mm或者年月日时分YYYY-MM-DD-HH-mm,不设置年时,默认使用当前年,该取值表示选择器弹窗时弹窗界面的默认选择值。 | | 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> | | 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 | 否 | 设置日期时间选择器弹窗界面是否为农历展示。 | | lunar<sup>5+</sup> | boolean | false | 否 | 设置日期时间选择器弹窗界面是否为农历展示。 |
| lunarswitch | boolean | false | 否 | 设置日期时间选择器是否显示农历开关,显示农历开关时,可以在弹窗界面展现农历的开关由于公历和农历切换。在设置显示农历时,开关状态为开,当设置不显示农历时,开关状态为关。手机生效。 | | lunarswitch | boolean | false | 否 | 设置日期时间选择器是否显示农历开关,显示农历开关时,可以在弹窗界面展现农历的开关由于公历和农历切换。在设置显示农历时,开关状态为开,当设置不显示农历时,开关状态为关。 |
多列文本选择器:type=multi-text 多列文本选择器:type=multi-text
| 名称 | 类型 | 默认值 | 必填 | 描述 | | 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- | | -------- | ------- | --------- | ---- | ---------------------------------------- |
| columns | number | - | 是 | 设置多列文本选择器的列数。 | | 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"]]。 | | 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,…] | 否 | 设置多列文本选择器的默认值,每一列被选中项对应的索引构成的数组,该取值表示选择器弹窗时弹窗界面的默认选择值。 | | selected | Array | [0,0,0,…] | 否 | 设置多列文本选择器的默认值,每一列被选中项对应的索引构成的数组,该取值表示选择器弹窗时弹窗界面的默认选择值。 |
## 样式 ## 样式
除支持[通用样式](../arkui-js/js-components-common-styles.md)外,还支持如下样式: 除支持[通用样式](../arkui-js/js-components-common-styles.md)外,还支持如下样式:
| 名称 | 类型 | 默认值 | 必填 | 描述 | | 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- | | -------------------------------- | -------------- | ---------- | ---- | ---------------------------------------- |
| color | &lt;color&gt | \#ffffff | 否 | 候选项字体颜色。 | | color | &lt;color&gt | \#ffffff | 否 | 候选项字体颜色。 |
| font-size | &lt;length&gt; | 16px | 否 | 候选项字体尺寸,类型length,单位px。 | | font-size | &lt;length&gt; | 16px | 否 | 候选项字体尺寸,类型length,单位px。 |
| selected-color | &lt;color&gt; | #ff0a69f7 | 否 | 选中项字体颜色。 | | selected-color | &lt;color&gt; | #ff0a69f7 | 否 | 选中项字体颜色。 |
| selected-font-size | &lt;length&gt; | 20px | 否 | 选中项字体尺寸,类型length,单位px。 | | selected-font-size | &lt;length&gt; | 20px | 否 | 选中项字体尺寸,类型length,单位px。 |
| disappear-color<sup>5+</sup> | &lt;color&gt; | \#ffffff | 否 | 渐变消失项的字体颜色。消失项是在一列中有五个选项场景下最上和最下的两个选项。 | | disappear-color<sup>5+</sup> | &lt;color&gt; | \#ffffff | 否 | 渐变消失项的字体颜色。消失项是在一列中有五个选项场景下最上和最下的两个选项。 |
| disappear-font-size<sup>5+</sup> | &lt;length&gt; | 14px | 否 | 渐变消失项的字体尺寸。消失项是在一列中有五个选项场景下最上和最下的两个选项。 | | disappear-font-size<sup>5+</sup> | &lt;length&gt; | 14px | 否 | 渐变消失项的字体尺寸。消失项是在一列中有五个选项场景下最上和最下的两个选项。 |
| font-family | string | sans-serif | 否 | 选项字体类型。字体列表,用逗号分隔,每个字体用字体名或者字体族名设置。列表中第一个系统中存在的或者通过[自定义字体](../arkui-js/js-components-common-customizing-font.md)指定的字体,会被选中作为文本的字体。 | | font-family | string | sans-serif | 否 | 选项字体类型。字体列表,用逗号分隔,每个字体用字体名或者字体族名设置。列表中第一个系统中存在的或者通过[自定义字体](../arkui-js/js-components-common-customizing-font.md)指定的字体,会被选中作为文本的字体。 |
## 事件 ## 事件
...@@ -85,32 +85,32 @@ ...@@ -85,32 +85,32 @@
type=text: type=text:
| 名称 | 参数 | 描述 | | 名称 | 参数 | 描述 |
| -------- | -------- | -------- | | ------ | ---------------------------------------- | --------------- |
| change | {&nbsp;newValue:&nbsp;newValue,&nbsp;newSelected:&nbsp;newSelected&nbsp;} | 文本选择器选定值后触发该事件。 | | change | {&nbsp;newValue:&nbsp;newValue,&nbsp;newSelected:&nbsp;newSelected&nbsp;} | 文本选择器选定值后触发该事件。 |
type=time: type=time:
| 名称 | 参数 | 描述 | | 名称 | 参数 | 描述 |
| -------- | -------- | -------- | | ------ | ---------------------------------------- | ------------------------------- |
| change | {&nbsp;hour:&nbsp;hour,&nbsp;minute:&nbsp;minute,&nbsp;[second:second]} | 时间选择器选定值后触发该事件。<br/>包含秒时,返回时分秒。 | | change | {&nbsp;hour:&nbsp;hour,&nbsp;minute:&nbsp;minute,&nbsp;[second:second]} | 时间选择器选定值后触发该事件。<br/>包含秒时,返回时分秒。 |
type=date: type=date:
| 名称 | 参数 | 描述 | | 名称 | 参数 | 描述 |
| -------- | -------- | -------- | | ------ | ---------------------------------------- | --------------- |
| change | {&nbsp;year:year,&nbsp;month:month,&nbsp;day:day&nbsp;} | 日期选择器选择值后触发该事件。 | | change | {&nbsp;year:year,&nbsp;month:month,&nbsp;day:day&nbsp;} | 日期选择器选择值后触发该事件。 |
type=datetime: type=datetime:
| 名称 | 参数 | 描述 | | 名称 | 参数 | 描述 |
| -------- | -------- | -------- | | ------ | ---------------------------------------- | ----------------- |
| change | {&nbsp;year:year,&nbsp;month:month,&nbsp;day:day,&nbsp;&nbsp;hour:hour,&nbsp;minute:minute&nbsp;} | 日期时间选择器选择值后触发该事件。 | | change | {&nbsp;year:year,&nbsp;month:month,&nbsp;day:day,&nbsp;&nbsp;hour:hour,&nbsp;minute:minute&nbsp;} | 日期时间选择器选择值后触发该事件。 |
type=multi-text: type=multi-text:
| 名称 | 参数 | 描述 | | 名称 | 参数 | 描述 |
| -------- | -------- | -------- | | ------------ | ---------------------------------------- | ---------------------------------------- |
| columnchange | {&nbsp;column:column,&nbsp;newValue:newValue,&nbsp;newSelected:newSelected&nbsp;} | 多列文本选择器某一列的值改变时触发该事件,column:第几列修改,newValue:选中的值,newSelected:选中值对应的索引。 | | columnchange | {&nbsp;column:column,&nbsp;newValue:newValue,&nbsp;newSelected:newSelected&nbsp;} | 多列文本选择器某一列的值改变时触发该事件,column:第几列修改,newValue:选中的值,newSelected:选中值对应的索引。 |
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
除支持[通用属性](../arkui-js/js-components-common-attributes.md)外,还支持如下属性: 除支持[通用属性](../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) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> >
...@@ -37,21 +37,21 @@ ...@@ -37,21 +37,21 @@
除支持[通用样式](../arkui-js/js-components-common-styles.md)外,还支持如下样式: 除支持[通用样式](../arkui-js/js-components-common-styles.md)外,还支持如下样式:
| 名称 | 类型 | 默认值 | 必填 | 描述 | | 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------- | -------- | -------- | -------- | -------- | | --------------- | ------ | ---------- | ---- | ---------------------------------------- |
| flex-direction | string | row | 否 | flex容器主轴方向。可选项有:<br/>-&nbsp;column:垂直方向从上到下<br/>-&nbsp;row:水平方向从左到右 | | 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;均匀排列每个元素,每个元素之间的间隔相等。 | | 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)外,还支持如下事件: 除支持[通用事件](../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为空时收拢所有分组。 | | 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 { ...@@ -39,7 +39,7 @@ export default {
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 针对数组内的数据修改,请使用splice方法生效数据绑定变更。 > - 针对数组内的数据修改,请使用splice方法生效数据绑定变更。
> >
> - hml文件中的js表达式不支持ES6语法。 > - hml文件中的js表达式不支持ES6语法。
...@@ -185,7 +185,7 @@ Touch触摸类事件支持捕获,捕获阶段位于冒泡阶段之前,捕获 ...@@ -185,7 +185,7 @@ Touch触摸类事件支持捕获,捕获阶段位于冒泡阶段之前,捕获
<div grab:touchstart.capture="touchstartfunc"></div> <div grab:touchstart.capture="touchstartfunc"></div>
</div> </div>
``` ```
``` ```
// xxx.js // xxx.js
export default { export default {
...@@ -247,9 +247,9 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有 ...@@ -247,9 +247,9 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 数组中的每个元素必须存在tid指定的数据属性,否则运行时可能会导致异常。 > - 数组中的每个元素必须存在tid指定的数据属性,否则运行时可能会导致异常。
> >
> - 数组中被tid指定的属性要保证唯一性,如果不是则会造成性能损耗。比如,示例中只有id和name可以作为tid字段,因为它们属于唯一字段。 > - 数组中被tid指定的属性要保证唯一性,如果不是则会造成性能损耗。比如,示例中只有id和name可以作为tid字段,因为它们属于唯一字段。
> >
> - tid不支持表达式。 > - tid不支持表达式。
...@@ -262,8 +262,8 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有 ...@@ -262,8 +262,8 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
<div class="container"> <div class="container">
<button class="btn" type="capsule" value="toggleShow" onclick="toggleShow"></button> <button class="btn" type="capsule" value="toggleShow" onclick="toggleShow"></button>
<button class="btn" type="capsule" value="toggleDisplay" onclick="toggleDisplay"></button> <button class="btn" type="capsule" value="toggleDisplay" onclick="toggleDisplay"></button>
<text if="{{visible}}"> Hello-TV </text> <text if="{{visible}}"> Hello-world1 </text>
<text elif="{{display}}"> Hello-Wearable </text> <text elif="{{display}}"> Hello-world2 </text>
<text else> Hello-World </text> <text else> Hello-World </text>
</div> </div>
``` ```
......
...@@ -11,7 +11,7 @@ ...@@ -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 @Entry
@Component @Component
struct MyComponent { struct MyComponent {
......
...@@ -101,9 +101,8 @@ export default { ...@@ -101,9 +101,8 @@ export default {
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![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是用来显示列表的组件,包含一系列相同宽度的列表项, ...@@ -39,7 +39,7 @@ List是用来显示列表的组件,包含一系列相同宽度的列表项,
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![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-group&gt;是&lt;list&gt;的子组件,实现列表分组功能,不能再嵌套&lt;list&gt;,可以嵌套&lt;list-item&gt;。
> >
> - &lt;list-item&gt;是&lt;list&gt;的子组件,展示列表的具体项。 > - &lt;list-item&gt;是&lt;list&gt;的子组件,展示列表的具体项。
...@@ -112,7 +112,7 @@ List是用来显示列表的组件,包含一系列相同宽度的列表项, ...@@ -112,7 +112,7 @@ List是用来显示列表的组件,包含一系列相同宽度的列表项,
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - indexer属性生效需要flex-direction属性配合设置为column,且columns属性设置为1。 > - indexer属性生效需要flex-direction属性配合设置为column,且columns属性设置为1。
> >
> - indexer可以自定义索引表,自定义时"\#"必须要存在。 > - indexer可以自定义索引表,自定义时"\#"必须要存在。
...@@ -214,7 +214,7 @@ export default { ...@@ -214,7 +214,7 @@ export default {
<div class="container"> <div class="container">
<div class="in-container"> <div class="in-container">
<text class="name">{{$item.name}}</text> <text class="name">{{$item.name}}</text>
<text class="phone">18888888888</text> <text class="number">18888888888</text>
</div> </div>
</div> </div>
</list-item> </list-item>
...@@ -247,7 +247,7 @@ export default { ...@@ -247,7 +247,7 @@ export default {
color: #000000; color: #000000;
font-size: 39px; font-size: 39px;
} }
.phone { .number {
color: black; color: black;
font-size: 25px; font-size: 25px;
} }
......
...@@ -70,9 +70,8 @@ export default { ...@@ -70,9 +70,8 @@ export default {
![zh-cn_image_0000001189098638](figures/zh-cn_image_0000001189098638.gif) ![zh-cn_image_0000001189098638](figures/zh-cn_image_0000001189098638.gif)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 普通选择器设置取值范围时,需要使用数据绑定的方式。 >
> > 普通选择器设置取值范围时,需要使用数据绑定的方式。
> - 日期选择器的lunarswitch属性只支持手机和平板设备。
## 设置时间展现格式 ## 设置时间展现格式
...@@ -108,7 +107,7 @@ Picker的hours属性定义时间的展现格式,可选类型有12小时制和2 ...@@ -108,7 +107,7 @@ Picker的hours属性定义时间的展现格式,可选类型有12小时制和2
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - hours属性为12:按照12小时制显示,用上午和下午进行区分; > - hours属性为12:按照12小时制显示,用上午和下午进行区分;
> >
> - hours属性为24:按照24小时制显示。 > - hours属性为24:按照24小时制显示。
......
...@@ -91,10 +91,10 @@ Slider组件通过color、selected-color、block-color样式分别为滑动条 ...@@ -91,10 +91,10 @@ Slider组件通过color、selected-color、block-color样式分别为滑动条
![zh-cn_image_0000001179438692](figures/zh-cn_image_0000001179438692.gif) ![zh-cn_image_0000001179438692](figures/zh-cn_image_0000001179438692.gif)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> mode属性为滑动条样式,仅在手机和平板上生效,可选值为: > mode属性为滑动条样式,可选值为:
> >
> - outset:滑块在滑杆上; > - outset:滑块在滑杆上;
> >
> - inset:滑块在滑杆内。 > - inset:滑块在滑杆内。
......
...@@ -10,7 +10,7 @@ Text是文本组件,用于呈现一段文本信息。具体用法请参考[Tex ...@@ -10,7 +10,7 @@ Text是文本组件,用于呈现一段文本信息。具体用法请参考[Tex
``` ```
<!-- xxx.hml --> <!-- xxx.hml -->
<div class="container" style="text-align: center;justify-content: center; align-items: center;"> <div class="container" style="text-align: center;justify-content: center; align-items: center;">
<text> Hello World </text> <text>Hello World</text>
</div> </div>
``` ```
...@@ -35,178 +35,175 @@ Text是文本组件,用于呈现一段文本信息。具体用法请参考[Tex ...@@ -35,178 +35,175 @@ 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;
}
```
![zh-cn_image_0000001220778205](figures/zh-cn_image_0000001220778205.png)
```
<!-- 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)
- 添加划线 - 添加划线
设置text-decoration和text-decoration-colo属性为文本添加划线和划线颜色,text-decoration枚举值请参考 Text自有样式。 设置text-decoration和text-decoration-colo属性为文本添加划线和划线颜色,text-decoration枚举值请参考 Text自有样式。
```
<!-- xxx.hml --> <!-- xxx.hml -->
<div class="container" style="background-color:#F1F3F5;"> <div class="container" style="background-color:#F1F3F5;">
<text style="text-decoration:underline"> <text style="text-decoration:underline">
This is a passage This is a passage
</text> </text>
<text style="text-decoration:line-through;text-decoration-color: red"> <text style="text-decoration:line-through;text-decoration-color: red">
This is a passage This is a passage
</text> </text>
</div> </div>
``` ```
/* xxx.css */
.container { ```
width: 100%; /* xxx.css */
height: 100%; .container {
flex-direction: column; width: 100%;
align-items: center; height: 100%;
justify-content: center; flex-direction: column;
} align-items: center;
text{ justify-content: center;
font-size: 50px; }
} text{
``` font-size: 50px;
}
```
![zh-cn_image_0000001220856725](figures/zh-cn_image_0000001220856725.png) ![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 --> <!-- xxx.hml -->
<div class="container"> <div class="container">
<div class="content"> <div class="content">
<text class="text1"> <text class="text1">
Welcome to the world
</text>
<text class="text2">
Welcome to the world Welcome to the world
</text> </text>
<text class="text2">
Welcome to the world
</text>
</div>
</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)子组件 - 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) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 当使用Span子组件组成文本段落时,如果Span属性样式异常(例如:font-weight设置为1000),将导致文本段落显示异常。 > - 当使用Span子组件组成文本段落时,如果Span属性样式异常(例如:font-weight设置为1000),将导致文本段落显示异常。
> >
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
Seafood, Seafood,
Dessert Dessert
} }
let NextId = 0; let NextId = 0;
class FoodData { class FoodData {
id: string; id: string;
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
fat: number; fat: number;
carbohydrates: number; carbohydrates: number;
vitaminC: number; vitaminC: number;
constructor(name: string, image: Resource, category: Category, calories: number, protein: number, 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.id = `${ NextId++ }`;
this.name = name; this.name = name;
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
} }
``` ```
3. 存入食物图片资源。在resources &gt; phone &gt; media目录下存入食物图片资源,图片名称为食物名称。 3. 存入食物图片资源。在resources &gt;base&gt; media目录下存入食物图片资源,图片名称为食物名称。
4. 创建食物资源数据。在model文件夹下创建FoodDataModels.ets,在该页面中声明食物成分数组FoodComposition。 4. 创建食物资源数据。在model文件夹下创建FoodDataModels.ets,在该页面中声明食物成分数组FoodComposition。
实际开发中,开发者可以自定义更多的数据资源,当食物资源很多时,建议使用数据懒加载LazyForEach。 实际开发中,开发者可以自定义更多的数据资源,当食物资源很多时,建议使用数据懒加载LazyForEach。
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
} }
// FoodDataModels.ets // FoodDataModels.ets
import { Category, FoodData } from './FoodData' import { Category, FoodData } from './FoodData'
export function initializeOnStartup(): Array<FoodData> { export function initializeOnStartup(): Array<FoodData> {
let FoodDataArray: Array<FoodData> = [] let FoodDataArray: Array<FoodData> = []
FoodComposition.forEach(item => { FoodComposition.forEach(item => {
......
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
![zh-cn_image_0000001168059158](figures/zh-cn_image_0000001168059158.png) ![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) ![zh-cn_image_0000001167746622](figures/zh-cn_image_0000001167746622.png)
5. 工程创建完成后,打开app.ets。 4. 工程创建完成后,打开app.ets。
app.ets提供了应用生命周期的接口:onCreate和onDestroy,分别在应用创建之初和应用被销毁时调用。在app.ets里可以声明全局变量,并且声明的数据和方法是整个应用共享的。 app.ets提供了应用生命周期的接口:onCreate和onDestroy,分别在应用创建之初和应用被销毁时调用。在app.ets里可以声明全局变量,并且声明的数据和方法是整个应用共享的。
``` ```
export default { export default {
onCreate() { onCreate() {
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
}, },
} }
``` ```
6. 在工程导航栏里,打开index.ets。该页面展示了当前的UI描述,声明式UI框架会自动生成一个组件化的struct,这个struct遵循Builder接口声明,在build方法里面声明当前的布局和组件。 5. 在工程导航栏里,打开index.ets。该页面展示了当前的UI描述,声明式UI框架会自动生成一个组件化的struct,这个struct遵循Builder接口声明,在build方法里面声明当前的布局和组件。
``` ```
@Entry @Entry
@Component @Component
...@@ -50,14 +50,16 @@ ...@@ -50,14 +50,16 @@
} }
``` ```
7. 点击右侧的Previewer按钮,打开预览窗口。可以看到在手机设备类型的预览窗口中“Hello World”居中加粗显示。 6. 点击右侧的Previewer按钮,打开预览窗口。可以看到预览窗口中“Hello World”居中加粗显示。
如果没有Previewer按钮,点击settings &gt; SDK Manager &gt; OpenHarmony SDK&gt; Tools 查看是否安装了Previewer。 如果没有Previewer按钮,点击settings &gt; SDK Manager &gt; OpenHarmony SDK&gt; Tools 查看是否安装了Previewer。
![zh-cn_image_0000001214595111](figures/zh-cn_image_0000001214595111.png) ![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) ![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) ![zh-cn_image_0000001158896538](figures/zh-cn_image_0000001158896538.png)
...@@ -43,15 +43,9 @@ ...@@ -43,15 +43,9 @@
![zh-cn_image_0000001168410342](figures/zh-cn_image_0000001168410342.png) ![zh-cn_image_0000001168410342](figures/zh-cn_image_0000001168410342.png)
3. 通过资源访问图片。 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) 将Tomato.png放入media文件夹内。就可以通过`$r('app.type.name')`的形式引用应用资源,即`$r('app.media.Tomato')`
点击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')`
``` ```
@Entry @Entry
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
2. 点击FoodGridItem后跳转到FoodDetail页面。调用页面路由router模块的push接口,将FoodDetail页面推到路由栈中,实现页面跳转。使用router路由API接口,需要先引入router。 2. 点击FoodGridItem后跳转到FoodDetail页面。调用页面路由router模块的push接口,将FoodDetail页面推到路由栈中,实现页面跳转。使用router路由API接口,需要先引入router。
``` ```
import router from '@system.router' import router from '@system.router'
@Component @Component
struct FoodGridItem { struct FoodGridItem {
private foodItem: FoodData private foodItem: FoodData
...@@ -69,11 +69,11 @@ ...@@ -69,11 +69,11 @@
![zh-cn_image_0000001169918548](figures/zh-cn_image_0000001169918548.gif) ![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 // FoodDetail.ets
import router from '@system.router' import router from '@system.router'
@Component @Component
struct PageTitle { struct PageTitle {
build() { build() {
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
``` ```
// FoodDetail.ets // FoodDetail.ets
import { FoodData } from '../model/FoodData' import { FoodData } from '../model/FoodData'
@Entry @Entry
@Component @Component
struct FoodDetail { struct FoodDetail {
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
@Component @Component
struct FoodDetail { struct FoodDetail {
private foodItem: FoodData = router.getParams().foodData private foodItem: FoodData = router.getParams().foodData
build() { build() {
...... ......
} }
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
}) })
} }
} }
@Component @Component
struct FoodImageDisplay { struct FoodImageDisplay {
private foodItem: FoodData private foodItem: FoodData
...@@ -210,11 +210,11 @@ ...@@ -210,11 +210,11 @@
.backgroundColor('#FFedf2f5') .backgroundColor('#FFedf2f5')
} }
} }
@Component @Component
struct ContentTable { struct ContentTable {
private foodItem: FoodData private foodItem: FoodData
@Builder IngredientItem(title:string, name: string, value: string) { @Builder IngredientItem(title:string, name: string, value: string) {
Flex() { Flex() {
Text(title) Text(title)
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
.layoutWeight(2) .layoutWeight(2)
} }
} }
build() { build() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Start }) { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Start }) {
this.IngredientItem('Calories', 'Calories', this.foodItem.calories + 'kcal') this.IngredientItem('Calories', 'Calories', this.foodItem.calories + 'kcal')
...@@ -244,12 +244,12 @@ ...@@ -244,12 +244,12 @@
.padding({ top: 30, right: 30, left: 30 }) .padding({ top: 30, right: 30, left: 30 })
} }
} }
@Entry @Entry
@Component @Component
struct FoodDetail { struct FoodDetail {
private foodItem: FoodData = router.getParams().foodData private foodItem: FoodData = router.getParams().foodData
build() { build() {
Column() { Column() {
Stack( { alignContent: Alignment.TopStart }) { Stack( { alignContent: Alignment.TopStart }) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册