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

!5906 添加setDisplayOrientation描述

Merge pull request !5906 from 于文泽/master
......@@ -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.
先完成此消息的编辑!
想要评论请 注册