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

Update docs (13383)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 f7c5bc33
...@@ -16,15 +16,15 @@ Reference: [Notification](../reference/apis/js-apis-notification.md#notification ...@@ -16,15 +16,15 @@ Reference: [Notification](../reference/apis/js-apis-notification.md#notification
Example: Example:
``` ```ts
import WantAgent from '@ohos.wantAgent'; import WantAgent from '@ohos.wantAgent';
async function publishNotification() { async function publishNotification() {
let wantAgentInfo = { let wantAgentInfo = {
wants: [ wants: [
{ {
bundleName: "com.example.notification", bundleName: "com.example.myapplication",
abilityName: "MainAbility", abilityName: "EntryAbility",
} }
], ],
operationType: WantAgent.OperationType.START_ABILITIES, operationType: WantAgent.OperationType.START_ABILITIES,
......
...@@ -165,9 +165,9 @@ Before the window content is loaded, enable listening for the **systemAvoidAreaC ...@@ -165,9 +165,9 @@ Before the window content is loaded, enable listening for the **systemAvoidAreaC
Example: Example:
``` ```ts
// MainAbility.ts import Window from '@ohos.window';
import window from '@ohos.window'; import UIAbility from '@ohos.app.ability.UIAbility';
/** /**
* Set the immersive window and obtain the height of the status bar and navigation bar. * Set the immersive window and obtain the height of the status bar and navigation bar.
...@@ -187,7 +187,7 @@ async function enterImmersion(mainWindow: window.Window) { ...@@ -187,7 +187,7 @@ async function enterImmersion(mainWindow: window.Window) {
statusBarContentColor: "#FF0000" statusBarContentColor: "#FF0000"
}) })
} }
export default class MainAbility extends Ability { export default class EntryAbility extends UIAbility {
// do something // do something
async onWindowStageCreate(windowStage: window.WindowStage) { async onWindowStageCreate(windowStage: window.WindowStage) {
let mainWindow = await windowStage.getMainWindow() let mainWindow = await windowStage.getMainWindow()
...@@ -213,7 +213,7 @@ You can obtain the changes in the width and height of a component through **onAr ...@@ -213,7 +213,7 @@ You can obtain the changes in the width and height of a component through **onAr
Example: Example:
``` ```ts
Column() { Column() {
Text(this.value) Text(this.value)
.backgroundColor(Color.Green).margin(30).fontSize(20) .backgroundColor(Color.Green).margin(30).fontSize(20)
...@@ -235,7 +235,7 @@ Bind the **\<List>** component to a **Scoller** object and obtain the offset thr ...@@ -235,7 +235,7 @@ Bind the **\<List>** component to a **Scoller** object and obtain the offset thr
Example: Example:
``` ```ts
Column() { Column() {
List({ space: 20, initialIndex: 0,scroller: this.scroller}) { List({ space: 20, initialIndex: 0,scroller: this.scroller}) {
ForEach(this.arr, (item) => { ForEach(this.arr, (item) => {
...@@ -259,7 +259,7 @@ Column() { ...@@ -259,7 +259,7 @@ Column() {
Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
``` ```ts
// In versions earlier than 3.1.5.5, obtain the value through router.getParams().key. // In versions earlier than 3.1.5.5, obtain the value through router.getParams().key.
private value: string = router.getParams().value; private value: string = router.getParams().value;
// In 3.1.6.5 and later versions, obtain the value through router.getParams()['key']. // In 3.1.6.5 and later versions, obtain the value through router.getParams()['key'].
...@@ -299,7 +299,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 ...@@ -299,7 +299,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
The color can be represented in two formats, for example, 0x7F000000 or '\#7F000000'. The first two digits indicate opacity, and the last six digits indicate RGB. The color can be represented in two formats, for example, 0x7F000000 or '\#7F000000'. The first two digits indicate opacity, and the last six digits indicate RGB.
``` ```ts
fontColor(0x7F000000) fontColor(0x7F000000)
fontColor( '#7F000000' ) fontColor( '#7F000000' )
``` ```
......
# @ohos.enterprise.adminManager # @ohos.enterprise.adminManager (Enterprise Device Management)
The **adminManager** module provides enterprise device management capabilities so that devices have the custom capabilities required in enterprise settings. The **adminManager** module provides enterprise device management capabilities so that devices have the custom capabilities required in enterprise settings.
...@@ -48,7 +48,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -48,7 +48,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
let enterpriseInfo = { let enterpriseInfo = {
name: "enterprise name", name: "enterprise name",
...@@ -100,7 +100,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -100,7 +100,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
let enterpriseInfo = { let enterpriseInfo = {
name: "enterprise name", name: "enterprise name",
...@@ -157,7 +157,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -157,7 +157,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
let enterpriseInfo = { let enterpriseInfo = {
name: "enterprise name", name: "enterprise name",
...@@ -324,7 +324,7 @@ Disables a device super administrator application based on the specified bundle ...@@ -324,7 +324,7 @@ Disables a device super administrator application based on the specified bundle
For details about the following error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md). For details about the following error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------------------------------------------- | | ------- | ----------------------------------------------------------------- |
| 9200005 | failed to disable the administrator application of the device. | | 9200005 | failed to disable the administrator application of the device. |
...@@ -582,7 +582,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -582,7 +582,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
let enterpriseInfo = { let enterpriseInfo = {
name: "enterprise name", name: "enterprise name",
...@@ -635,7 +635,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -635,7 +635,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
let enterpriseInfo = { let enterpriseInfo = {
name: "enterprise name", name: "enterprise name",
...@@ -676,7 +676,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -676,7 +676,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
adminManager.getEnterpriseInfo(wantTemp, (error, result) => { adminManager.getEnterpriseInfo(wantTemp, (error, result) => {
if (error != null) { if (error != null) {
...@@ -723,7 +723,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -723,7 +723,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
adminManager.getEnterpriseInfo(wantTemp).then((result) => { adminManager.getEnterpriseInfo(wantTemp).then((result) => {
console.log(result.name); console.log(result.name);
......
# @ohos.enterprise.deviceInfo # @ohos.enterprise.deviceInfo (Device Information Management)
The **deviceInfo** module provides APIs for enterprise device information management, including the API for obtaining device serial numbers. These APIs can only be called by device administrator applications. The **deviceInfo** module provides APIs for enterprise device information management, including the API for obtaining device serial numbers. These APIs can only be called by device administrator applications.
...@@ -45,7 +45,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -45,7 +45,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
deviceInfo.getDeviceSerial(wantTemp, (error, result) => { deviceInfo.getDeviceSerial(wantTemp, (error, result) => {
if (error != null) { if (error != null) {
...@@ -94,7 +94,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -94,7 +94,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
deviceInfo.getDeviceSerial(wantTemp).then((result) => { deviceInfo.getDeviceSerial(wantTemp).then((result) => {
console.log(result); console.log(result);
...@@ -136,7 +136,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -136,7 +136,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
deviceInfo.getDisplayVersion(wantTemp, (error, result) => { deviceInfo.getDisplayVersion(wantTemp, (error, result) => {
if (error != null) { if (error != null) {
...@@ -185,7 +185,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -185,7 +185,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
deviceInfo.getDisplayVersion(wantTemp).then((result) => { deviceInfo.getDisplayVersion(wantTemp).then((result) => {
console.log(result); console.log(result);
...@@ -227,7 +227,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -227,7 +227,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
deviceInfo.getDeviceName(wantTemp, (error, result) => { deviceInfo.getDeviceName(wantTemp, (error, result) => {
if (error != null) { if (error != null) {
...@@ -276,7 +276,7 @@ For details about the following error codes, see [Enterprise Device Management E ...@@ -276,7 +276,7 @@ For details about the following error codes, see [Enterprise Device Management E
```js ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "EntryAbility",
}; };
deviceInfo.getDeviceName(wantTemp).then((result) => { deviceInfo.getDeviceName(wantTemp).then((result) => {
console.log(result); console.log(result);
......
...@@ -17,7 +17,7 @@ Before using the **AccessibilityExtensionContext** module, you must define a chi ...@@ -17,7 +17,7 @@ Before using the **AccessibilityExtensionContext** module, you must define a chi
```ts ```ts
import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility' import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility'
let axContext; let axContext;
class MainAbility extends AccessibilityExtensionAbility { class EntryAbility extends AccessibilityExtensionAbility {
onConnect(): void { onConnect(): void {
console.log('AxExtensionAbility onConnect'); console.log('AxExtensionAbility onConnect');
axContext = this.context; axContext = this.context;
......
# InputMethodExtensionContext # @ohos.inputmethodextensioncontext (InputMethodExtensionContext)
The **InputMethodExtensionContext** module, inherited from **ExtensionContext**, provides context for **InputMethodExtension** abilities. The **InputMethodExtensionContext** module, inherited from **ExtensionContext**, provides context for **InputMethodExtension** abilities.
...@@ -20,7 +20,7 @@ Before using the **InputMethodExtensionContext** module, you must define a child ...@@ -20,7 +20,7 @@ Before using the **InputMethodExtensionContext** module, you must define a child
```js ```js
import InputMethodExtensionAbility from '@ohos.inputmethodextensionability'; import InputMethodExtensionAbility from '@ohos.inputmethodextensionability';
class MainAbility extends InputMethodExtensionAbility { class EntryAbility extends InputMethodExtensionAbility {
onCreate() { onCreate() {
let context = this.context; let context = this.context;
} }
......
...@@ -173,7 +173,7 @@ The following examples are not intended as copy-paste-ready. Further customizati ...@@ -173,7 +173,7 @@ The following examples are not intended as copy-paste-ready. Further customizati
"clickOneDay": { "clickOneDay": {
"action": "router", "action": "router",
"bundleName": "com.example.calendar", "bundleName": "com.example.calendar",
"abilityName": "com.example.calendar.MainAbility", "abilityName": "EntryAbility",
"params": { "params": {
"action": "click_month_view_event", "action": "click_month_view_event",
"day": "$event.day", "day": "$event.day",
......
...@@ -112,7 +112,7 @@ You can also implement redirection to the target application using a **want**, w ...@@ -112,7 +112,7 @@ You can also implement redirection to the target application using a **want**, w
"action": "router", "action": "router",
"want": { "want": {
"bundleName": "com.example.myapplication", "bundleName": "com.example.myapplication",
"abilityName": "com.example.entry.MainAbility" "abilityName": "EntryAbility"
} }
}, },
"routerEventName2": { "routerEventName2": {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册