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

Update docs (18854)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 b9ce938a
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
- [Common Events of the Ability Subsystem](common_event/commonEvent-ability.md) - [Common Events of the Ability Subsystem](common_event/commonEvent-ability.md)
- [Common Events of the Bundle Management Subsystem](common_event/commonEvent-bundleManager.md) - [Common Events of the Bundle Management Subsystem](common_event/commonEvent-bundleManager.md)
- [Common Events of the Notification Service](common_event/commonEvent-ans.md) - [Common Events of the Notification Service](common_event/commonEvent-ans.md)
- [Common Events of the Resource Scheduling Subsystem](common_event/commonEvent-resourceschedule.md) - [Common Events of the Resource Scheduler Subsystem](common_event/commonEvent-resourceschedule.md)
- [Common Events of the Telephony Subsystem](common_event/commonEvent-telephony.md) - [Common Events of the Telephony Subsystem](common_event/commonEvent-telephony.md)
- [Common Events of the USB Subsystem](common_event/commonEvent-usb.md) - [Common Events of the USB Subsystem](common_event/commonEvent-usb.md)
- Bundle Management - Bundle Management
...@@ -335,6 +335,7 @@ ...@@ -335,6 +335,7 @@
- [@ohos.web.webview (Webview)](js-apis-webview.md) - [@ohos.web.webview (Webview)](js-apis-webview.md)
- [Console](js-apis-logs.md) - [Console](js-apis-logs.md)
- [Timer](js-apis-timer.md) - [Timer](js-apis-timer.md)
- [SysCap](js-apis-syscap.md)
- application - application
- [AccessibilityExtensionContext (Accessibility Extension Context)](js-apis-inner-application-accessibilityExtensionContext.md) - [AccessibilityExtensionContext (Accessibility Extension Context)](js-apis-inner-application-accessibilityExtensionContext.md)
......
...@@ -5,6 +5,8 @@ The **Animator** module provides APIs for applying animation effects, including ...@@ -5,6 +5,8 @@ The **Animator** module provides APIs for applying animation effects, including
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> This module can be used only after a component instance is created, and it cannot be used in the [UIAbility](./js-apis-app-ability-uiAbility.md).
## Modules to Import ## Modules to Import
......
...@@ -5,6 +5,8 @@ The **mediaquery** module provides different styles for different media types. ...@@ -5,6 +5,8 @@ The **mediaquery** module provides different styles for different media types.
> **NOTE** > **NOTE**
> >
> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
>
> This module can be used only after a component instance is created, and it cannot be used in the [UIAbility](./js-apis-app-ability-uiAbility.md).
## Modules to Import ## Modules to Import
...@@ -26,7 +28,7 @@ Sets the media query condition. This API returns the corresponding media query l ...@@ -26,7 +28,7 @@ Sets the media query condition. This API returns the corresponding media query l
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ---------------------------------------- | | --------- | ------ | ---- | ---------------------------------------- |
| condition | string | Yes | Media query condition. For details, see [Syntax of Media Query Conditions](../../ui/arkts-layout-development-media-query.md#syntax-of-media-query-conditions).| | condition | string | Yes | Media query condition. For details, see [Syntax](../../ui/arkts-layout-development-media-query.md#syntax).|
**Return value** **Return value**
...@@ -146,7 +148,7 @@ struct MediaQueryExample { ...@@ -146,7 +148,7 @@ struct MediaQueryExample {
} }
aboutToAppear() { aboutToAppear() {
let portraitFunc = this.onPortrait.bind(this) // Bind the current JS instance. let portraitFunc = this.onPortrait.bind(this) // Bind the JS instance.
this.listener.on('change', portraitFunc) this.listener.on('change', portraitFunc)
} }
...@@ -158,5 +160,3 @@ struct MediaQueryExample { ...@@ -158,5 +160,3 @@ struct MediaQueryExample {
} }
} }
``` ```
<!--no_check-->
\ No newline at end of file
...@@ -5,6 +5,8 @@ The **PromptAction** module provides APIs for creating and showing toasts, dialo ...@@ -5,6 +5,8 @@ The **PromptAction** module provides APIs for creating and showing toasts, dialo
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> This module can be used only after a component instance is created, and it cannot be used in the [UIAbility](./js-apis-app-ability-uiAbility.md).
## Modules to Import ## Modules to Import
......
# SysCap
SystemCapability (SysCap) refers to a standalone feature in the operating system. Different devices support different SysCap sets. Each SysCap corresponds to one or more APIs. You can determine whether an API can be used by checking SysCap support.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## canIUse
canIUse(syscap: string): boolean
Checks whether a SysCap is supported.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| syscap | string | Yes| Name of the SysCap to check.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Check result. The value **true** means that the SysCap is supported, and **false** means the opposite.|
**Example**
```js
import geolocation from '@ohos.geolocation'
const isLocationAvailable = canIUse('SystemCapability.Location.Location');
if (isLocationAvailable) {
geolocation.getCurrentLocation((location) => {
console.log(location.latitude, location.longitue);
});
} else {
console.log('Location not by this device.');
}
```
...@@ -21,7 +21,7 @@ Tabs(value?: {barPosition?: BarPosition, index?: number, controller?: [TabsContr ...@@ -21,7 +21,7 @@ Tabs(value?: {barPosition?: BarPosition, index?: number, controller?: [TabsContr
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------- | --------------------------------- | ---- | ------------------------------------------------------------ | | ----------- | --------------------------------- | ---- | ------------------------------------------------------------ |
| barPosition | BarPosition | No | Position of the **\<Tabs>** component.<br>Default value: **BarPosition.Start** | | barPosition | BarPosition | No | Position of the **\<Tabs>** component.<br>Default value: **BarPosition.Start** |
| index | number | No | Initial tab index.<br>Default value: **0**<br>**NOTE**<br>A value less than 0 evaluates to the default value.<br>The value ranges from 0 to the number of **\<TabContent>** subnodes minus 1.<br>When this parameter is set to different values, the slide animation for tab switching is enabled by default. To disable the animation, set **animationDuration** to **0**.<br>Since API version 10, this parameter supports [$$](../../quick-start/arkts-two-way-sync.md) for two-way binding of variables.| | index | number | No | Initial tab index.<br>Default value: **0**<br>**NOTE**<br>A value less than 0 evaluates to the default value.<br>The value ranges from 0 to the number of **\<TabContent>** subnodes minus 1.<br>When this parameter is set to different values, the slide animation for tab switching is enabled by default. To disable the animation, set **animationDuration** to **0**.<br>Since API version 10, this parameter supports [$$](../../quick-start/arkts-two-way-sync.md) for two-way binding of variables. |
| controller | [TabsController](#tabscontroller) | No | Tab controller. | | controller | [TabsController](#tabscontroller) | No | Tab controller. |
## BarPosition ## BarPosition
...@@ -41,9 +41,9 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -41,9 +41,9 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| vertical | boolean | Whether to use vertical tabs. The value **true** means to use vertical tabs, and **false** means to use horizontal tabs.<br>Default value: **false**| | vertical | boolean | Whether to use vertical tabs. The value **true** means to use vertical tabs, and **false** means to use horizontal tabs.<br>Default value: **false**|
| scrollable | boolean | Whether the tabs are scrollable. The value **true** means that the tabs are scrollable, and **false** means the opposite.<br>Default value: **true**| | scrollable | boolean | Whether the tabs are scrollable. The value **true** means that the tabs are scrollable, and **false** means the opposite.<br>Default value: **true**|
| barMode | BarMode | Tab bar layout mode. For details, see **BarMode**.<br>Default value: **BarMode.Fixed**| | barMode | BarMode | Tab bar layout mode. For details, see **BarMode**.<br>Default value: **BarMode.Fixed**|
| barWidth | number \| Length<sup>8+</sup> | Width of the tab bar.<br>**NOTE**<br><br>A value less than 0 or greater than the width of the **\<Tabs>** component evaluates to the default value.| | barWidth | number \| Length<sup>8+</sup> | Width of the tab bar.<br>The default value varies.<br>If the tab bar has the **vertical** attribute set to **false** and does not have a style specified, the default value is the width of the **\<Tabs>** component.<br>If the tab bar has the **vertical** attribute set to **true** and does not have a style specified, the default value is **56vp**.<br>If the tab bar has the **vertical** attribute set to **false** and **SubTabbarStyle** specified, the default value is the width of the **\<Tabs>** component.<br>If the tab bar has the **vertical** attribute set to **true** and **SubTabbarStyle** specified, the default value is **56vp**.<br>If the tab bar has the **vertical** attribute set to **true** and **BottomTabbarStyle** specified, the default value is **96vp**.<br>If the tab bar has the **vertical** attribute set to **false** and **BottomTabbarStyle** specified, the default value is the width of the **\<Tabs>** component.<br>**NOTE**<br><br>A value less than 0 or greater than the width of the **\<Tabs>** component evaluates to the default value.|
| barHeight | number \| Length<sup>8+</sup> | Height of the tab bar.<br>**NOTE**<br>A value less than 0 or greater than the width of the **\<Tabs>** component evaluates to the default value. | | barHeight | number \| Length<sup>8+</sup> | Height of the tab bar.<br>The default value varies.<br>If the tab bar has the **vertical** attribute set to **false** and does not have a style specified, the default value is **56vp**.<br>If the tab bar has the **vertical** attribute set to **true** and does not have a style specified, the default value is the height of the **\<Tabs>** component.<br>If the tab bar has the **vertical** attribute set to **false** and **SubTabbarStyle** specified, the default value is **56vp**.<br>If the tab bar has the **vertical** attribute set to **true** and **SubTabbarStyle** specified, the default value is the height of the **\<Tabs>** component.<br>If the tab bar has the **vertical** attribute set to **true** and **BottomTabbarStyle** specified, the default value is the height of the **\<Tabs>** component.<br>If the tab bar has the **vertical** attribute set to **false** and **BottomTabbarStyle** specified, the default value is **56vp**.<br>**NOTE**<br>A value less than 0 or greater than the height of the **\<Tabs>** component evaluates to the default value. |
| animationDuration | number | Duration of the slide animation for tab switching. If this parameter is set, the tab switching animation is played when the user switches between tabs by sliding or clicking. If this parameter is not set, the tab switching animation is played only when the user switches between tabs by sliding.<br>Default value: **300**<br>**NOTE**<br>A value less than 0 or in percentage evaluates to the default value.| | animationDuration | number | Duration of the slide animation for tab switching. If this parameter is set, the tab switching animation is played when the user switches between tabs by sliding or clicking. If this parameter is not set, the tab switching animation is played only when the user switches between tabs by sliding.<br>Default value: **300**<br>**NOTE**<br>A value less than 0 or in percentage evaluates to the default value. |
| divider<sup>10+</sup> | [DividerStyle](#dividerstyle10) \| null | Whether the divider is displayed for the **\<TabBar>** and **\<TabContent>** components and the divider style. By default, the divider is not displayed.<br> **DividerStyle**: divider style.<br> **null**: The divider is not displayed.| | divider<sup>10+</sup> | [DividerStyle](#dividerstyle10) \| null | Whether the divider is displayed for the **\<TabBar>** and **\<TabContent>** components and the divider style. By default, the divider is not displayed.<br> **DividerStyle**: divider style.<br> **null**: The divider is not displayed.|
| fadingEdge<sup>10+</sup> | boolean | Whether the tab fades out when it exceeds the container width.<br>Default value: **true** | | fadingEdge<sup>10+</sup> | boolean | Whether the tab fades out when it exceeds the container width.<br>Default value: **true** |
...@@ -91,7 +91,7 @@ Switches to the specified tab. ...@@ -91,7 +91,7 @@ Switches to the specified tab.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------------------------- | | ----- | ------ | ---- | ---------------------------------------- |
| value | number | Yes | Index of the tab. The value starts from 0.<br>**NOTE**<br><br>If this parameter is set to a value less than 0 or greater than the maximum number, the event will be invalid.| | value | number | Yes | Index of the tab. The value starts from 0.<br>**NOTE**<br>If this parameter is set to a value less than 0 or greater than the maximum number, the event will be invalid. |
## Example ## Example
......
...@@ -112,9 +112,10 @@ struct CustomDialogUser { ...@@ -112,9 +112,10 @@ struct CustomDialogUser {
customStyle: false customStyle: false
}) })
// Delete the dialogController instance and set it to undefined when the custom component is about to be destroyed.
aboutToDisappear() { aboutToDisappear() {
delete this.dialogController, delete this.dialogController, // Delete the dialogController instance.
this.dialogController = undefined this.dialogController = undefined //Set dialogController to undefined.
} }
onCancel() { onCancel() {
......
...@@ -93,29 +93,49 @@ By default, the associated SysCap set of an application is the union of multiple ...@@ -93,29 +93,49 @@ By default, the associated SysCap set of an application is the union of multiple
### Checking Whether an API Is Available ### Checking Whether an API Is Available
- Method 1: Use the **canIUse()** API to check whether a SysCap is supported. You can use either the ArtTS or native API to determine whether an API is available.
```ts - ArkTS API
if (canIUse("SystemCapability.ArkUI.ArkUI.Full")) {
console.log("This device supports SystemCapability.ArkUI.ArkUI.Full."); - Method 1: Use the **canIUse()** API to check whether a SysCap is supported.
} else {
console.log("This device does not support SystemCapability.ArkUI.ArkUI.Full."); ```ts
} if (canIUse("SystemCapability.ArkUI.ArkUI.Full")) {
``` console.log("This device supports SystemCapability.ArkUI.ArkUI.Full.");
} else {
- Method 2: Import a module using the **import** API. If the current device does not support the module, the import result is **undefined**. Before using an API, you must make sure the API is available. console.log("This device does not support SystemCapability.ArkUI.ArkUI.Full.");
}
```ts ```
import geolocation from '@ohos.geolocation';
- Method 2: Import a module using the **import** API. If the current device does not support the module, the import result is **undefined**. Before using an API, you must make sure the API is available.
if (geolocation) {
geolocation.getCurrentLocation((location) => { ```ts
console.log(location.latitude, location.longitude); import geolocation from '@ohos.geolocation';
});
} else { if (geolocation) {
console.log('This device does not support location information.'); geolocation.getCurrentLocation((location) => {
} console.log(location.latitude, location.longitude);
``` });
} else {
console.log('This device does not support location information.');
}
```
- Native API
```c
#include <stdio.h>
#include <stdlib.h>
#include "syscap_ndk.h"
char syscap[] = "SystemCapability.ArkUI.ArkUI.Full";
bool result = canIUse(syscap);
if (result) {
printf("SysCap: %s is supported!\n", syscap);
} else {
printf("SysCap: %s is not supported!\n", syscap);
}
```
You can also find out the SysCap to which an API belongs by referring to the API reference document. You can also find out the SysCap to which an API belongs by referring to the API reference document.
### Checking the Differences Between Devices with a Specific SysCap ### Checking the Differences Between Devices with a Specific SysCap
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册