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

!23746 窗口ts示例代码 arkts 告警修复

Merge pull request !23746 from lixia/master
...@@ -41,12 +41,13 @@ onConnect(want: Want): void ...@@ -41,12 +41,13 @@ onConnect(want: Want): void
**示例:** **示例:**
```ts ```ts
export default class MyWindowExtensionAbility extends WindowExtensionAbility { import WindowExtensionAbility from '@ohos.application.WindowExtensionAbility';
import Want from '@ohos.app.ability.Want';
onConnect(want) { export default class MyWindowExtensionAbility extends WindowExtensionAbility {
onConnect(want: Want) {
console.info('WindowExtAbility onConnect, abilityName: ${want.abilityName}'); console.info('WindowExtAbility onConnect, abilityName: ${want.abilityName}');
} }
} }
``` ```
...@@ -68,12 +69,13 @@ onDisconnect(want: Want): void ...@@ -68,12 +69,13 @@ onDisconnect(want: Want): void
**示例:** **示例:**
```ts ```ts
export default class MyWindowExtensionAbility extends WindowExtensionAbility { import WindowExtensionAbility from '@ohos.application.WindowExtensionAbility';
import Want from '@ohos.app.ability.Want';
onDisconnect(want) { export default class MyWindowExtensionAbility extends WindowExtensionAbility {
onDisconnect(want: Want) {
console.info('WindowExtAbility onDisconnect, abilityName: ${want.abilityName}'); console.info('WindowExtAbility onDisconnect, abilityName: ${want.abilityName}');
} }
} }
``` ```
...@@ -95,16 +97,20 @@ onWindowReady(window: window.Window): void ...@@ -95,16 +97,20 @@ onWindowReady(window: window.Window): void
**示例:** **示例:**
```ts ```ts
import WindowExtensionAbility from '@ohos.application.WindowExtensionAbility';
import window from '@ohos.window';
let windowStage: window.WindowStage | null = null
export default class MyWindowExtensionAbility extends WindowExtensionAbility { export default class MyWindowExtensionAbility extends WindowExtensionAbility {
onWindowReady(windowClass: window.Window) {
onWindowReady(window) { windowStage!.loadContent('WindowExtAbility/pages/index1').then(() => {
window.loadContent('WindowExtAbility/pages/index1').then(() => { windowClass.getProperties().then((pro: window.WindowProperties) => {
window.getProperties().then((pro) => {
console.log('WindowExtension pro: ${JSON.stringify(pro)}'); console.log('WindowExtension pro: ${JSON.stringify(pro)}');
}); });
window.show(); windowClass.show();
}); });
} }
} }
``` ```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册