1e41f4b71Sopenharmony_ci# BaseContext
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciBaseContext抽象类用于表示继承的子类Context是Stage模型还是FA模型,是所有Context类型的父类。
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **说明:**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## 导入模块
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci```ts
12e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit';
13e41f4b71Sopenharmony_ci```
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## 属性
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci| 名称       | 类型   | 可读   | 可写   | 说明      |
22e41f4b71Sopenharmony_ci| -------- | ------ | ---- | ---- | ------- |
23e41f4b71Sopenharmony_ci| stageMode | boolean | 是    | 是    | 表示是否Stage模型。<br>true:Stage模型<br>false:FA模型。 |
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci**示例:**
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci以Stage模型为例,用户可通过UIAbilityContext访问stageMode字段。
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci```ts
30e41f4b71Sopenharmony_ciimport { UIAbility, AbilityConstant, Want } from '@kit.AbilityKit';
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ciclass EntryAbility extends UIAbility {
33e41f4b71Sopenharmony_ci  onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
34e41f4b71Sopenharmony_ci    // EntryAbility onCreate, isStageMode: true
35e41f4b71Sopenharmony_ci    console.log(`EntryAbility onCreate, isStageMode: ${this.context.stageMode}`);
36e41f4b71Sopenharmony_ci  }
37e41f4b71Sopenharmony_ci}
38e41f4b71Sopenharmony_ci```
39