```
//MainAbility.ts
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
// 通过globalThis.context调用子类context,获取AbilityContext并调用相关方法
globalThis.context = this.context
windowStage.setUIContent(this.context, "pages/nav", null)
}
```