提交 3180172e 编写于 作者: A altay

Description:add doc

Sig:SIG_ApplicationFramework
Feature or Bugfix:Feature
Binary Source:No
Signed-off-by: Naltay <yuaqiang1@huawei.com>
Change-Id: I32f52b296fc8c924ea81193f3e40a73655b70502
上级 55d5bbd6
......@@ -43,6 +43,34 @@ export default {
}
```
### FA模型Context常用方法介绍
方法:
```javascript
setDisplayOrientation(orientation: bundle.DisplayOrientation, callback: AsyncCallback<void>): void
setDisplayOrientation(orientation: bundle.DisplayOrientation): Promise<void>;
```
简介:设置当前ability的显示方向。
示例:
```javascript
import featureAbility from '@ohos.ability.featureAbility'
import bundle from '../@ohos.bundle';
export default {
onCreate() {
// 获取context并调用相关方法
let context = featureAbility.getContext();
context.setDisplayOrientation(bundle.DisplayOrientation.LANDSCAPE).then(() => {
console.log("Set display orientation.")
})
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
```
## Stage模型和Context详细介绍
​ Stage模型有如下几类Context:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册